zakishah has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks Thanks for your time to time help, once again i need your assistance, i am tring to open a file that contains names of other text files, which i need to open to display their contents, i am struggling hard but countering various errors. i need you help to tell me how to open file.txt which is in other text file e.g ( in my code ) junk.txt Thanks again!
my $file = "junk.txt"; open FH, '<', "$file"; my @lines; while (<FH>) { push (@lines, $_); } close FH or die "Cannot close $file: $!"; my @dude; my $count= @lines + 1; for(my $k = 0; $k<$count; $k++){ open FILE, '<', "@lines[k]" or die $!; while (my $line = <FILE>) { my ($ip) = $line =~ /(\d+\.\d+\.\d+\.\d+)/; push(@dude,$ip); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: No Such File or Directory Error
by 2teez (Vicar) on Aug 27, 2012 at 23:57 UTC | |
|
Re: No Such File or Directory Error
by morgon (Priest) on Aug 28, 2012 at 00:17 UTC | |
|
Re: No Such File or Directory Error
by Rudolf (Pilgrim) on Aug 28, 2012 at 00:17 UTC |