On Thu, 10 Sep 2009 17:43:47 +0530, Ajay Kumar wrote:
> And
> $$_ you can understand like below
> 
> 
> $name="ajay";
> $class="name"
> 
> $$class== ajay

It is unlikely that the original code was called with symbolic references 
like you have just explained.  More likely it was called with real 
references by putting a backslash in front of the variable name.

Unless it's written by someone whose Perl learning stopped with Perl 4.

The code is poor from the standpoints of layout, variable naming, 
interface design, unintended modes of operation, incomplete understanding 
of regular expressions, and lack of documentation.  It would be better if 
replaced with

# trim( $x ) - alter $x in place removing leading/trailing whitespace
sub trim { $_[0] =~ s/^\s*(.*?)\s*$/$1/ }


> Jyoti wrote:
>> Can someone explain me what these symbols mean in regular expression:
>> 
>> my $trim = sub {local($_)=shift;
>>      $$_ =~ s/^\s*//;
>>      $$_ =~ s/\s*$//;};

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to