in reply to Re: How to call subroutines using variables ?
in thread How to call subroutines using variables ?
eval "&$s()";Oof. Don't do that. It's a lot safer to turn of strict refs instead:
That should still be treated with care, though. It will run ANY subroutine (even in other packages) that can be reached by name. Using your eval STRING option will run ANY code that happens to be in $s. Like:no strict 'refs'; $s->(); use strict;
updated: fixed quoting$s = "print(); unlink '/etc/passwd'; s";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to call subroutines using variables ?
by Anonymous Monk on Aug 13, 2007 at 20:49 UTC | |
by Joost (Canon) on Aug 13, 2007 at 20:52 UTC |