in reply to moving the filehandle to anyline of a file
You can also:
while ($fh) { /^Confname/ or next; work_with $_; last; ## if you want to process only the first ocurrence of such l +ine }
If the lines in the file are not very long, it may fit in memory:
my @confnames = grep /^Confname/, <$fh>; ## if you want to process all lines: work_with $_ for @confnames; ## else: work_with $confnames[0];
Update: Fixed a missing <>. Thanks to Tanktalus!
--
David Serrano
|
|---|