Perl Monk, Perl Meditation | |
PerlMonks |
Re: Parse for a name after a keyword search in all the files, given directory as inputby kcott (Archbishop) |
on Feb 18, 2017 at 00:11 UTC ( [id://1182250]=note: print w/replies, xml ) | Need Help?? |
G'day prash_sri, Welcome to the Monastery. I see you've received copious, excellent advice on things to fix. When you've fixed all those issues, and finally want to open a specific file, remember that the file is in $dir, which is not necessarily the current directory: open "$dir/$file", not $file. When dealing with a single item, use the singular form, as I did in the previous paragraph: use $file not $files (which looks like an arrayref to me, e.g. my $files = \@files;). Also, you might find the autodie pragma useful. — Ken
In Section
Seekers of Perl Wisdom
|
|