I would do it like this:
#!/usr/bin/perl use warnings; use strict; my $file = '775066.dat'; open my $SPG, '<', $file or die "Couldn't open $file: $!\n"; while ( <$SPG> ) { my ( $title, @data ) = split; @data = split ' ', <$SPG> unless @data; print "$title $data[-2]\n"; }
In reply to Re: Regexes, stitching broken lines, and other fun stuff.
by jwkrahn
in thread Regexes, stitching broken lines, and other fun stuff.
by vxp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |