in reply to Operator held in scalar/array element

No, not an operator, but you can hold a reference to a sub.
my @permissions = ( sub { -e $_[0] }, ); if ($permissions[0]->($file))

Replies are listed 'Best First'.
Re^2: Operator held in scalar/array element
by AngryKumquat (Initiate) on May 06, 2009 at 23:29 UTC
    Thank you this also works perfectly. Can I just clarify why in the method/subroutine I need the index to $_. I tried it without and it doesn't work. "sub { -e $_ }" instead of "sub { -e $_[0] }". Why does the file parameter need to be referenced as index[0]?
      sub { -e $_[0] }
      is short for
      sub { my ($file) = @_; -e $file }

      I hope that clarifies things.

      Sorry. Don't worry about that secondary question. My brain has gone to bed before my body. Thanks for the help.