[EMAIL PROTECTED] schreef:
> $_ = "aaa_b_ccccc_.ddd";
> ($a, $b, $c, $d, $e, $e) = (split /_|\./)[1,2,3,4,5,6];
> I am not getting the "aaa". I am getting b when I should be getting a.
As mentioned already, you missed that indexes start at 0.
Consider:
my %data;
my @keys = qw/a b c d e f/;
@[EMAIL PROTECTED] = split /_|\./;
Test:
$ perl -MData::Dumper -e'
$Data::Dumper::Sortkeys = 1;
$_ = "aaa_b_ccccc_.ddd";
my %data;
my @keys = qw/a b c d e f/;
@[EMAIL PROTECTED] = split /_|\./;
print Dumper(\%data);
'
$VAR1 = {
'a' => 'aaa',
'b' => 'b',
'c' => 'ccccc',
'd' => '',
'e' => 'ddd',
'f' => undef
};
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/