On Thu, Feb 14, 2002 at 03:34:56PM +0530, SubbaReddy M wrote:
> <=> How to check the input direction is given or not in perl, @ = <STDIN>;
> => like @ = <STDIN> if ( defined <STDIN> );   But this will not full fill
> the requirement, because, it's prompting
> for input, if redirection missing at commandline.

#!/usr/bin/perl

unless (-t STDIN) {
  @a = <STDIN>;
} else {
  print "No file\n";
}

HTH!

-- 
Dan Boger
Linux MVP
brainbench.com

Reply via email to