in reply to How do I backtrack while reading a file line-by-line?
Nothing to do with your question, but...
while ($newline = <FILEHANDLE>){
use strict; use warnings;
and then
while (my $newline = <FILEHANDLE>){
if ($newline = /^>/) {
This is most probably not what you want, since you're assigning to $newline. You want
if ($newline =~ /^>/) {
instead.
$stuff = $newline; &play_with($stuff);
Unless play_with() modifies its argument, you may want to pass $newline directly to it, without passing through an intermediate variable. But more importantly, the &-form of sub call is now obsolete and likely not to do what one may think, so unless you do know, don't!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I backtrack while reading a file line-by-line?
by mdunnbass (Monk) on Oct 18, 2006 at 20:21 UTC | |
by mdunnbass (Monk) on Oct 18, 2006 at 20:24 UTC |