New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
print $outfh <$infh> gives Syntax Error #16242
Comments
From @jimavThis is a bug report for perl from jim.avera@gmail.com, If print is called with $fh instead of an old-style FILEHANDLE (no comma print $outfh <$infh> #Syntax Error No error occurs if $outfh or $infh is replaced by HANDLE, of if <$infh> #!/usr/bin/perl open INFH, "<", "/etc/timezone" or die; open OUTFH, ">&STDOUT" or die; local $/; #slurp print $outfh <$infh> or die; # SYNTAX ERROR Flags: Site configuration information for perl 5.24.1: Configured by Debian Project at Sat Mar 18 17:00:39 UTC 2017. Summary of my perl5 (revision 5 version 24 subversion 1) configuration: Platform: Locally applied patches: @INC for perl 5.24.1: Environment for perl 5.24.1: |
From zefram@fysh.org
"$outfh <$infh" parses as a comparison expression. A syntax error -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @jimavAh, thanks. I had no idea that braces were allowed to be used like that. methodname {expr yielding object ref} args... or is this an example of a more general concept? Normally I would Just point me to the docs and I'll read. Thanks again, On 11/11/2017 04:16 PM, Zefram via RT wrote:
|
From zefram@fysh.orgJim Avera wrote:
It's legal by fiat. A braced block is one of the permitted forms of
There's an ambiguity between hash constructors and code blocks in many -zefram |
From @xsawyerxOn 11/12/2017 09:20 AM, Jim Avera wrote:
Hi, Jim. :) The docs for print (perldoc -f print) include the following paragraph: If you're storing handles in an array or hash, or in general print { $files[$i] } "stuff\n"; This is what includes the ability to do (as also mentioned by Perl Best print {$fh} "foo"; |
@cpansprout - Status changed from 'open' to 'rejected' |
From @jimavThank you Zefram & Sawyer for the explanation. I appreciate it. Sorry for the bogus bugrep |
From @xsawyerxOn 11/13/2017 08:07 AM, Jim Avera wrote:
Don't worry about it. :) |
Migrated from rt.perl.org#132434 (status was 'rejected')
Searchable as RT132434$
The text was updated successfully, but these errors were encountered: