Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > The meaning of @

Reply
Thread Tools

The meaning of @

 
 
Leslie Viljoen
Guest
Posts: n/a
 
      02-27-2005
Hello!

I have been trying to figure out one of Abigail's JAPH
signatures (check http://www.cpan.org/misc/japh):

#!/usr/bin/perl -lw
eval {die [[qq [Just another Perl Hacker]]]};;
print
${${${@}}[$#{@{${@}}}]}
[$#{${@{${@}}}
[$#{@{${@}}}]}]

This is the center of the expression in a few places: ${@}
Are we dereferencing the @? What does the @ on its own mean?
The Programming Perl manual I have makes no reference to this
shorthand and Google and Altavista don't seem to search on
punctuation.

I have tried printing ${@} and @, but I get nothing.
Presumeably the die puts the error message in the @ in some
format.

Can someone please explain?

Les
 
Reply With Quote
 
 
 
 
GreenLeaf
Guest
Posts: n/a
 
      02-27-2005
Leslie Viljoen wrote:
> Hello!
>
> I have been trying to figure out one of Abigail's JAPH
> signatures (check http://www.cpan.org/misc/japh):
>
> Can someone please explain?
>
> Les


Didn't she answer this same question from you once, a few days back? )

 
Reply With Quote
 
 
 
 
Fabian Pilkowski
Guest
Posts: n/a
 
      02-27-2005
Leslie Viljoen schrieb:
>
> I have been trying to figure out one of Abigail's JAPH
> signatures (check http://www.cpan.org/misc/japh):
>
> #!/usr/bin/perl -lw
> eval {die [[qq [Just another Perl Hacker]]]};;
> print
> ${${${@}}[$#{@{${@}}}]}
> [$#{${@{${@}}}
> [$#{@{${@}}}]}]
>
> This is the center of the expression in a few places: ${@}
> Are we dereferencing the @? What does the @ on its own mean?
> The Programming Perl manual I have makes no reference to this
> shorthand and Google and Altavista don't seem to search on
> punctuation.


In Perl, you can write a var $foo as ${foo}. In some situations this
will be a handy abbrev e.g. in "${foo}bar" instead of $foo.'bar'. So
your questionable construct ${@} is simply the var $@. Have a look to
`perldoc perlvar` to learn more about $@. Consider the content of the
first pair of square brackets in Abigail's print-statement:

$#{ @{ ${@} } }
`--
just the var $@
`-------
dereferencing its value (seems to be an arrayref)
`-------------
getting this arrays highest index

I hope these steps will help you to understand that funny code.

regards,
fabian
 
Reply With Quote
 
Leslie Viljoen
Guest
Posts: n/a
 
      02-27-2005
GreenLeaf wrote:
> Leslie Viljoen wrote:
>
>> Hello!
>>
>> I have been trying to figure out one of Abigail's JAPH
>> signatures (check http://www.cpan.org/misc/japh):
>>
>> Can someone please explain?
>>
>> Les

>
>
> Didn't she answer this same question from you once, a few days back? )
>

Sorry I missed it. Thunderbird does not seem to highlight threads I
have posted in.

Fabian's reply was great though anyway.

Les
 
Reply With Quote
 
GreenLeaf
Guest
Posts: n/a
 
      02-28-2005
Leslie Viljoen wrote:

> Sorry I missed it. Thunderbird does not seem to highlight threads I
> have posted in.


May be OT, but View > Messages > Customize.. )

sat
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      02-28-2005
GreenLeaf wrote:

> Didn't she


She?

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
Iain Chalmers
Guest
Posts: n/a
 
      02-28-2005
In article <(E-Mail Removed)>,
Leslie Viljoen <(E-Mail Removed)> wrote:

> This is the center of the expression in a few places: ${@}
> Are we dereferencing the @? What does the @ on its own mean?


Just like ${foo} means the same thing as $foo (search for 'disambiguate'
in perldata), so ${@} is equivalent to $@, which perlvar tells us is the
short name for $EVAL_ERROR

>Presumeably the die puts the error message in the @ in some format.


Almost, die puts the error message into $@.

see:
perldoc perldata
perldoc perlvar

cheers,

big
--
On my tombstone they will carve, "IT NEVER GOT FAST
ENOUGH FOR ME."' - Hunter S Thompson, 1937-2005 RIP
 
Reply With Quote
 
GreenLeaf
Guest
Posts: n/a
 
      02-28-2005
John Bokma wrote:
> GreenLeaf wrote:
>
> > Didn't she

>
> She?
>


http://groups-beta.google.com/groups...il+%2Bshe+perl

How that information got _registered_ in my mind, I'm not sure. I guess
someone referred to Abigail as (she|her) in some other recent post.

Cheers,
sat
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      02-28-2005
GreenLeaf wrote:

> John Bokma wrote:
>> GreenLeaf wrote:
>>
>> > Didn't she

>>
>> She?

>
> http://groups-beta.google.com/groups...il+%2Bshe+perl
>
> How that information got _registered_ in my mind, I'm not sure. I guess
> someone referred to Abigail as (she|her) in some other recent post.


PurlGurl?

I use a nice nick a chat, and because the first part could be a girl's name
people mistake me often for a girl, which the regulars consider a very
funny thing (Ok, I admit, using pinkish colors does add to the
confusing).

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
Leslie Viljoen
Guest
Posts: n/a
 
      02-28-2005
GreenLeaf wrote:
> John Bokma wrote:
>
>> GreenLeaf wrote:
>>
>> > Didn't she

>> She?
>>

>
> http://groups-beta.google.com/groups...il+%2Bshe+perl
>
> How that information got _registered_ in my mind, I'm not sure. I guess
> someone referred to Abigail as (she|her) in some other recent post.


Hmmm, I apologise for that assumption. Abigail is an exclusively female
name in South Africa AFAIK. Well, half the world thinks I am female too,
going by my name.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding search queries, semantics, and "Meaning" ...aren't weall looking for meaning? 5lvqbwl02@sneakemail.com Python 4 01-14-2009 02:28 PM
use work.my_package.all-->what exactly meaning of this Parthav VHDL 4 01-13-2006 07:50 PM
WHAT IS THE MEANING *FESWANY MCSE 3 01-28-2005 02:55 PM
Meaning of word "develop" in the exam (70-300) TomTom MCSD 10 08-13-2004 04:39 PM
Meaning of output value? Sander Odekerken VHDL 2 05-18-2004 05:41 PM



Advertisments