in reply to Re: Splitting in while loop
in thread Splitting in while loop
# test.pl while (my $line = <>) { chomp $line; print qq{$line\n}; # yes I know, pointless use of chomp }
Similarly, you could do something destructive with pop or shift, like,> perl test.pl < test.pl # test.pl while (my $line = <>) { chomp $line; print qq{$line\n}; # yes I know, pointless use of chomp }
while (my $item = pop @my_array) { # do stuff with $item }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Splitting in while loop
by haukex (Archbishop) on Oct 12, 2021 at 16:41 UTC |