--- [EMAIL PROTECTED] wrote:
> Could someone please explain the use of -> and => as in following
> example?
> (A poor Windows user ... )
lol....
> $file = "/home/images/$name";
> open(IMAGE, ">$file") || die "unable to open filehandle $file \n";
> $saveres = $ua->request(HTTP::Request->new(GET => $pic));
> print IMAGE "$saveres";
-> (the pointer operator) is a dereferencer. It helps simplify access
to elements of something referenced by a scalar. For example:
my @a = qw/ a b c /;
my $aref = \@a; # $aref is now a reference to @a
uc ( $aref->[1] ); # should uppercase "b", $a[1]
You can pass $aref instead of the entire array, which is handy in lots
of cases. In the code above $ua is apparently an Apache request object,
and $ua->request(....) finds the method request through the fact that
$ua has been blessed into a package (c.f. perldoc perlobj and friends
=o)
=> is actually just a glorified comma that quotes the operand on its
left. This is a wonderful thing when building hashes, as you can type
and read it better:
my %h = ( a => 1, b => 2, c => 3 );
Notice a, b, anc c don't need quoting here, because => handles it. With
a normal comma, you'd have to quote them yourself.
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/