Using $@ to decide whether eval failed is error prone, in my experience. Instead I end my 'eval' expression with "; 1" and check whether eval returns a true value or not:
my $root= eval { require Win32; 1 } ? Win32::IsAdminUser() : $> == 0;
- tye
In reply to Re^4: Does $> have a little extra magic? ($@)
by tye
in thread Does $> have a little extra magic?
by chargrill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |