P
Pacman
I'm getting 'used' to hash arrays and am writing a perl script to
backup my harddrive automatically. I couldn't figure out how to get
the following code to work, so I must be making a mistake I can't see.
Here's my expected result:
foreaching on key one
result: red/green
instead I get the following:
foreaching on key one
two:three
foreaching on key HASH(0x804c014)
:
#!/usr/bin/perl
$BLAH = "one:red:green";
%NADA = {};
($b1,@b2) = split(/:/,$BLAH);
$NADA{$b1} = [@b2];
foreach $k(keys %NADA) {
print "foreaching on key $k\n";
@x = @{$NADA{$k}};
print "result: $x[0]/$x[1]\n";
}
Any help would be great...remove the nospam_ from the email address...
D-
backup my harddrive automatically. I couldn't figure out how to get
the following code to work, so I must be making a mistake I can't see.
Here's my expected result:
foreaching on key one
result: red/green
instead I get the following:
foreaching on key one
two:three
foreaching on key HASH(0x804c014)
:
#!/usr/bin/perl
$BLAH = "one:red:green";
%NADA = {};
($b1,@b2) = split(/:/,$BLAH);
$NADA{$b1} = [@b2];
foreach $k(keys %NADA) {
print "foreaching on key $k\n";
@x = @{$NADA{$k}};
print "result: $x[0]/$x[1]\n";
}
Any help would be great...remove the nospam_ from the email address...
D-