in reply to Pass Variables in PerlTray script

Without the benefit of having tried perltray, it looks like this should work:
["Do Something", sub { DoSomethingSub($a, $b, $c) } ]

Replies are listed 'Best First'.
Re: Re: Pass Variables in PerlTray script
by jand (Friar) on Mar 14, 2003 at 18:05 UTC
    Yes, that should work. You can also use the string form:
    ["Do Something", 'DoSomethingSub($a, $b, $c)']
    This string will get evaluated when you execute the menu option. Therefore you should only use package variables in the string, as lexicals will be out of scope at the point it is evaluated. And be careful to use single quotes on the string to make sure that the variables are not interpolated into the string at the time the menu is constructed.