I would do something like this.
#!perl use strict; foreach my $line (<DATA>){ if ( $line =~ /\bH00(.*)$/ ) { # print " hoo $1 \n"; } elsif ( $line =~ /\bH01(.*)$/ ) { # print " ho1 $1 \n"; } elsif ( $line =~ /\bD0(.*)$/ ) { # print " do1 $1 \n"; } } __DATA__ H00 Header1 H01 Header2 D01 data1 D02 data2
In reply to Re: Simple but not elegant ?
by crusty_collins
in thread Simple but not elegant ?
by matthew_t_dooley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |