$PatternToMatch="^SELECT";
$tmpfile="pattern.txt";
open(MYFILE, "$tmpfile")|| die "Cannot create $tmpfile\n";
while (<MYFILE>) {
if (/$PatternToMatch/)
{
push (@array, $_);
}
}
As you are reading the file, you need to push every time perl founds Select to and array, because the variable get overwritten with every success match.
After that, recover all the data from the array when you need.
foreach $control (@array) {
print "Line -> $control\n";
}
| [reply] |
Tanx Sombrerero loco.... its working :)
| [reply] |
$PatternToMatch="^SELECT";
$tmpfile="pattern.txt";
$var = '';
open(MYFILE, "<$tmpfile")|| die "Cannot create $tmpfile\n";
while (<MYFILE>) {
$var .= $_ if /$PatternToMatch/;
}
.
.
.
.
eval $var;
??
A user level that continues to overstate my experience :-))
| [reply] [d/l] |