SPUG: Dup'ing STDIN from DATA?

Tim Maher/CONSULTIX tim at consultix-inc.com
Thu Mar 15 12:04:42 CST 2001


> For those put off by the AWKisness (-n usage) of the above program,
> the following one doesn't work any better:
> 
> #! /usr/bin/perl -w
> 
> open STDIN, "<&DATA";
> 
> while (<>) {	# no arguments provided to script
> 	<do fun stuff with $_>
> }
> 
> __DATA__
> Stuff here

Actually, this one *does* work;  I couldn't tell initially because I had
an invisible (junk) argument lingering in vi's !!-command buffer, that
prevented STDIN from being accessed.  Sorry! 8-{

I'd still like to know how to make the -n version work, though, if
anybody has any ideas.

*==========================================================================*
|  Dr. Tim Maher, CEO, Consultix        (206) 781-UNIX/8649;  ask for FAX# |
|  Email: tim at consultix-inc.com         Web: http://www.consultix-inc.com  |
|  TIM MAHER: Unix/Perl   DAMIAN CONWAY: Adv. Perl   COLIN MEYER: Perl/DBI |
|  *We are currently scheduling On-Site Classes on UNIX and Perl topics!*  |
*==========================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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/



----- End forwarded message -----

-- 
*==========================================================================*
|  Dr. Tim Maher, CEO, Consultix        (206) 781-UNIX/8649;  ask for FAX# |
|  Email: tim at consultix-inc.com         Web: http://www.consultix-inc.com  |
|  TIM MAHER: Unix/Perl   DAMIAN CONWAY: Adv. Perl   COLIN MEYER: Perl/DBI |
|  *We are currently scheduling On-Site Classes on UNIX and Perl topics!*  |
*==========================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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