SPUG: Dup'ing STDIN from DATA?

David Dyck dcd at tc.fluke.com
Fri Mar 16 15:13:12 CST 2001



On Fri, 16 Mar 2001, Brian Ingerson wrote:

> BTW, This only works with 5.6.0+ (The *real* Perl ;)

Maybe there's a bug in bleading edge perl 5.7.0 but
to get the scripts you're talking about
to work I had to add the call to tell().
   (I submitted this bug via perlbug)

--- script 1
#! /usr/bin/perl -w

if ($] > 5.006) { tell(DATA) || die "tell:$!"; }
@ARGV = '<&DATA';

while (<>) { print }

__DATA__
one little
two little
three little indians
--- end script 1


--- script 2
#! /usr/bin/perl -pw

INIT { if ($] > 5.006) { tell(DATA) || die "tell:$!"; } }
BEGIN { @ARGV = '<&DATA' }

s/little/big/;
s/indian/idiot/;

__DATA__
one little
two little
three little indians
--- end script 1



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list