Rules | Recent posts | topic RSS | Search | Register  | Log in

Perl: What is -> operator stands for?

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Author Message
mike_bihan



Joined: 21 Mar 2002
Posts: 259


Post27 Aug 2008 14:50   Perl: What is -> operator stands for?

There is a line in perl script:

$a{$b} -> {$c}++;

what does this line do? thanks
Back to top
saeidj



Joined: 15 Dec 2007
Posts: 123
Helped: 28


Post28 Aug 2008 1:41   Re: Perl: What is -> operator stands for?

Quote:
$a{$b} -> {$c}++;

Hi
You know that:
$a is a scalar variable.
$a++ returns $a and then increments it.
The {} brackets are used to reference elements in the hash.
The -> is the infix dereference operator. It tells Perl that the thing being dereferenced on the left is connected to something on the right.

For more information, see these links:
http://www.cs.mcgill.ca/~abatko/computers/programming/perl/howto/hash/
http://www.cs.cf.ac.uk/Dave/PERL/node63.html
Back to top
mike_bihan



Joined: 21 Mar 2002
Posts: 259


Post28 Aug 2008 6:24   Perl: What is -> operator stands for?

A few things to confirm:

1. Does it means the $b element is a hash inside arrary a?

2. Does it incremen the element inside hash table "b" with key as " a"?

$a{$b} -> {$c} ++;
^^^^^^^^^^

3. Is $a{$b} -> {$c} ++; equivalent to

$a{$b{$c}} ++;

Thanks.
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Page 1 of 1 All times are GMT + 1 Hour


Abuse
Administrator
Moderators
topic RSS 
sitemap