http://www.perlmonks.org?node_id=204944


in reply to Re: (tye)Re: Cheap idioms
in thread Cheap idioms

This won't work for me, although tye's version will.
#!/usr/bin/perl use strict; use warnings; moose(); sub moose { my $filename = 'ter.pl'; my $contents = do { local (*ARGV, $/) = [ $filename ]; <> }; print $contents; } sub loose { my $filename = 'ter.pl'; my $data= do { local( *ARGV, $/ ); @ARGV= $filename; <> }; print $data; } __END__ readline() on unopened filehandle ARGV at foo.pl line 8. Use of uninitialized value in print at foo.pl line 9.
it opens a script to exemplify ternary ops. Nothing special there. Using: This is perl, v5.6.1 built for MSWin32-x86-multi-thread.

Replies are listed 'Best First'.
Re: Re: Re: (tye)Re: Cheap idioms
by Juerd (Abbot) on Oct 14, 2002 at 05:54 UTC

    Oh, darn, it doesn't work in 5.6.x, only 5.8. Ah well, back to tye's version then...

    I didn't know I had 5.8 installed :)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.