in reply to Converting data from file with multiline records
my $n = 3; my $re = '(\d+)'.('\s+(\S+)' x $n); my $qre = qr/$re/; # save it being compiled more than once # no need to load it all in, we can just split it differently # (assuming we can define a record separator) $/ = "\n "; # might want to save old value or reset later # or make a local block while(<DATA>) { my @things = /$qre/; print "++ @things\n"; } __DATA__ 654 -0.1192052729835885D-03 -0.1074533611698108D+02 0.2511576310952854D+05 655 -0.1173814075917466D-03 -0.1074770905898570D+02 0.2511659074419869D+05 656 -0.1169565901326905D-03 -0.1074824015295493D+02 0.2511670643648702D+05 657 -0.1169057197333296D-03 -0.1074839256994435D+02 .2511658884706037D+05 658 -0.1229838335208557D-03 -0.1074184682541694D+02 0.2511451830545289D+05
--
¤ Steve Marvell
|
|---|