Hi Peter,
There's at least a couple of ways you can do that.
1) Do a 'foreach' loop, "next"ing any line that doesn't start with the $goto variable you set. Ex:
foreach $line(@lines) {
next unless ($line=~/^$goto/);
### do your stuff if it matches
last; # prevents further parsing of later lines, if you've already found the line you were looking for
}
OR
use the 'seek' method. I'm not real well-versed, because I only hacked it into an existing script some years ago. Search the perl pages for examples of 'seek'ing.
Hope this helps.
There's at least a couple of ways you can do that.
1) Do a 'foreach' loop, "next"ing any line that doesn't start with the $goto variable you set. Ex:
foreach $line(@lines) {
next unless ($line=~/^$goto/);
### do your stuff if it matches
last; # prevents further parsing of later lines, if you've already found the line you were looking for
}
OR
use the 'seek' method. I'm not real well-versed, because I only hacked it into an existing script some years ago. Search the perl pages for examples of 'seek'ing.
Hope this helps.