in reply to Breaking up a really long string
I've tinkered with the string lengths to get something more manageble, but you should be able to see what's happening.
See $INPUT_RECORD_SEPARATOR in perlvar for details of what $/ = \$max_length does. See open for a description of the effect of using a scalar reference instead of a filename.
use strict; my $var = 'x' x 100; my $max_length = 10; $/ = \$max_length; # input record separator $\ = "\n"; # output record separator open my $FH, "<", \$var or die; print while <$FH>;
update: Added link to open
|
|---|