in reply to input record separator
Remember: the value of $/ is a string, not a regex.Your .* are regular expression syntax, but they are treated as a literal dot followed by a literal asterisk when assigned to the input record separator special variable.
If you want to avoid slurping your entire file into memory at once, you could operate on 3 lines at a time by creating a 3-line buffer:
use warnings; use strict; my @lines; while (<>) { push @lines, $_; if ($. % 3 == 0) { # do something with @lines; @lines = (); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: input record separator
by ikegami (Patriarch) on Jun 01, 2010 at 03:29 UTC |