on Thu, 01 Aug 2002 18:18:27 GMT, Learn Perl wrote:
> how do I find the line with only the "<" character?
>
> and store that line in a hash and the rest chomp them and store them
> as the hash value?
This stores the (chomped) lines as strings in an anonymous array:
#! perl -w
use strict;
my %hash;
my $key = '';
while (<DATA>){
chomp;
if (/^<(.*)$/) {
$key = $1;
} else {
push @{$hash{$key}}, $_ if $key;
}
}
__DATA__
<filename1: subfilename1
1 2 3 4 5 6...20
21 22.........40
etc
etc
<filename2: subfilename2
1 2 3 4 5 6...20
21 22 ........40
etc.
etc
--
felix
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]