Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Scalar variable value is name of a scalar variable

by GrandFather (Saint)
on Jul 01, 2009 at 08:48 UTC ( #776352=note: print w/replies, xml ) Need Help??


in reply to Re: Scalar variable value is name of a scalar variable
in thread Scalar variable value is name of a scalar variable

No need to use symbolic references when you can use real references instead, and with less typing:

if ($lev =~ /.*DEBUG.*/i){ $loglev = \$DEBUG; }elsif($lev =~ /.*INFO.*/i){ $loglev = \$INFO; }elsif($lev =~ /.*WARN.*/i){ $loglev = \$WARN; }elsif($lev =~ /.*ERROR.*/i){ $loglev = \$ERROR; }elsif($lev =~ /.*FATAL.*/i){ $loglev = \$FATAL; }else{ die "\nPlease provide the correct log level\n"; } my $logger = get_logger(); $logger->level($$loglev); # $DEBUG,$INFO,$WARN,$ERROR,$FATAL

True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://776352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-12-09 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (38 votes). Check out past polls.

    Notices?