Chas. Owens wrote:
On Apr 19, 2008, at 12:39, Richard Lee wrote:
what is the difference?? I thought doing [ ] and \ would do the
samething
snip
They do similar, but different, things. The \ operator takes a
reference to a variable and [] operator creates an anonymous array.
You can build [] from \ by using a temporary array that goes out of
scope.
my $linked = [EMAIL PROTECTED];
my $independent = do { #this is functionally the same as my
$independent = [EMAIL PROTECTED];
my @temp = @array;
[EMAIL PROTECTED];
}
Changes to @$linked will change @array, but changes to @$independent
will not.
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
one more question,
why does below not work?
while ( my ($key,$value) = each( %{$oj_s} ) ) {
print "$key and $value\n";
}
assuming that
oj_s contains
$VAR1 = {
'abc' => '10.0.0.1_1035',
'cde' => '192.168.1.1_1037',
'fgh' => '192.168.100.1_10',
}
I know that
while (my ($key,$value) = each(%hash)) {
print"$key and $value\n";
}
above works.. but for reference, do i need different syntax to extract
key and values?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/