In the "Advanced Perl book" it gives an example of using sym ref:
--
process a command-line option such as "-Ddebug_level=3" and set the
$debug_level variable. This is one way of doing it:

while ($arg = shift @ARGV){
    if ($arg =~ /-D(\w+)=(\w+)/) {
         $var_name = $1; $value = $2;
         $$var_name = $value;     # Or more compactly, $$1 = $2;
    }
}
----
how is this any better than:

while ($arg = shift @ARGV){
    if ($arg =~ /-D(\w+)=(\w+)/) {
         $level = $2;
       }
}
---

Or am i missing the point? I never use sym refs and just wondering why i
would ever want to

Thanks
Jim
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to