What does this symbol mean '->'

Showing Answers 1 - 9 of 9 Answers

max1x

  • May 20th, 2006
 

reference the method of a module.

use Net::Telnet;

my $q = new Telnet ();

$q->cmd('adkfjdk');

  Was this answer useful?  Yes

loginprompt

  • Jun 20th, 2006
 

In Perl it is an infix dereference operator. The if the rhs is an array subscript, or a hash key, or a subroutine, then the lhs must be a reference, can also be used as method invocation: invocant->method

  Was this answer useful?  Yes

prabhath_01

  • May 31st, 2008
 

Uses of  "->" Operator:
###################

1) Reference the method of a module.

use CGI;
my $cgi = new CGI ();
$cgi->header();

2) In Perl it is an infix dereference operator.

$arr = [ qw/ prabhath vamsi eswar sandhya God/];  #This is an Array Reference
print "n",$arr->[0];  #Right
print "n",$arr[0];     #Wrong as $arr is an array reference not an array      

@arr = qw/ prabhath vamsi eswar sandhya  God/;   #This is an Array
print "n",$arr->[0];  #Wrong
print "n",$arr[0];     #Right as @arr is an array

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions