use strict; use warnings; use Data::Dumper; my %actualhash = split /,/, shift; print Dumper \%actualhash;
eval takes whatever you hand to it and tries to compile it as code. So if you hand it print "Hello world.\n" it will print Hello World. Notice how we used quotes? So how about if we hand it say 'Hello world.';? We get the same output (if we use the say feature). And since q// is synonymous with single quotes, we can write that as, eval 'say q/Hello world./;'.
But we also know that the q// operator allows you to use other delimiters, such as q{}, or even q,, (the latter is handy for obfu, and confusing for real world code). By now you should be seeing why putting q, in your input string that you eval may be a problem.
This is an example of why everyone gets nervous and pops a blood pressure pill whenever they start talking about the string form of eval in the same conversation as 'raw user input'. Taint mode would make the very concept of evaling @ARGV args fatal.
Dave
In reply to Re: eval doesn't like the letter 'q'?
by davido
in thread eval doesn't like the letter 'q'?
by rastoboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |