Someone mentioned that sucking a file into an array is not a good
idea and I read the Perl fact on it but still am not sure why this is
not a good idea, especially because a lot of code posted uses this
method.
In addition, if you have the file in an array then you can do foreach:
open(FH, "text.fil") || die "Can't open text.fil\n";
my @array=<FH>;
close(FH);
foreach my $i (@array)
{if ($i=~/something/)
{print "$i\n";
}
}
Would one use while instead and what would the code look like?
open(FH, "text.fil") || die "Can't open text.fil\n";
while (<FH>)
{if (????what goes here to emulate the above foreach????)
{print "????ditto????\n";
}
}
close(FH);
--
-------------------------------
- Teresa Raymond -
- Mariposa Net -
- http://www.mariposanet.com -
-------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]