I am trying to simply write the results of my grep etc to a file.
According to what I read in books, I need to open the ouput file with ">" to overwrite or ">>" to append. And then use that filehandle in the print command
open (IN , "$file") or die "unable to open file";
Expand|Select|Wrap|Line Numbers
- #Find the lines in the file containing word 'hardware' #
- while (<IN>) {
- if ($num < 30 ) {
- @hardware_line = grep (/hardware/, $_);
- print "@hardware_line\n";
- }
- #-----------------------------------------------------#
- # Get just the hardware address from the whole line in the file
- #-----------------------------------------------------#
- foreach my $word (@hardware_line) {
- @hardware1 = split /\s+/, $word;
- $hardware = $hardware1[3];
- open (OUT, ">$out_file1") or die "unable to open output file";
- print OUT $hardware;
- close OUT or die "$!";
- }
Use of uninitialized value in concatenation (.) or string at search_IP_02.plx for line in BOLD
unable to open output file at search_IP_02.plx line for line in BOLD
Any comments?
M