On Wed, May 21, 2008 at 08:34:42PM -0600, [EMAIL PROTECTED] wrote:
> I get a syntax error when doing the following:
> 
>   my $contents  = do { local $/; < $m->request_args()->{upload} > };
> 
> However, this works just fine:
> 
>   my $fh = $m->request_args()->{upload};
>   my $contents = do { local $/; <$fh> };
> 
> Is this a bug in perl?

perldoc perlop, "I/O Operators":

  If what's within the angle brackets is neither a filehandle nor a simple
  scalar variable containing a filehandle name, typeglob, or typeglob reference,
  it is interpreted as a filename pattern to be globbed, and either a list of
  filenames or the next filename in the list is returned, depending on context.
  This distinction is determined on syntactic grounds alone.  That means "<$x>"
  is always a readline() from an indirect handle, but "<$hash{key}>" is always a
  glob().  That's because $x is a simple scalar variable, but $hash{key} is
  not--it's a hash element.  Even "<$x >" (note the extra space) is treated as
  "glob("$x ")", not "readline($x)".

(The answer to "is this a bug in perl?" is usually "No", especially when the
subject is a common operation.)

hdp.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to