Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!samsung!zaphod.mps.ohio-state.edu!mips!sgi!shinobu!odin!sgihub!sgitokyo!kandall From: kandall@sgitokyo.nsg.sgi.com (Michael Kandall) Newsgroups: comp.lang.perl Subject: Perl STDIN and ARGV Summary: Canonical form for processing either STDIN or ARGV Message-ID: <1991Jan28.083825.15064@sgitokyo.nsg.sgi.com> Date: 28 Jan 91 08:38:25 GMT Organization: Nihon Silicon Graphics, Japan Lines: 25 I am new to Perl and this newsgroup. It looks like a useful language. A common UNIX(tm) System utility usage is to process command line args, and if they are not present to process stdin. What's the standard paradigm for switching between these two in Perl? Can a FILEHANDLE be associated with an arbitrary array? A natural equivalence would be one array element per line. Something like: if( $nargs == 1 ) { open( INPUT, '-' ); } else { open( INPUT, ARGV ); # ???? } while( ) { print $_ ; } -- ---- Michael Kandall Independent Consultant Nihon Silicon Graphics