Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is $@ - used with 'eval' 2

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
0
0
GB
Hi,

I've found that when using eval as a try/catch clause any errors are placed into $@ , but what is this strange variable.

The built in defaults usually have an underscore with them @_ , $_ etc.

I've tried Googling , but there search algorithm can't handle $@ even if placed in quotes [lol]

Thanks,
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Perl has many such variables. They are internal variables that Perl sets. Perl 5 introduced a verbal names for each of them (which are not available by default).

Here are some more examples:
$@ = $EVAL_ERROR
$] = $PERL_VERSION
$$ = $PROCESS_ID
$. = $INPUT_LINE_NUMBER
$^O = $OSNAME
 
[link]http://perldoc.perl.org/perlvar.html[/url]

- Miller
 
Thanks guys, much appreciated.

Though according to perlvar '$]' & '$[' are deprecated.

regards
1DMF



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top