My program takes in any number of files including a '-' or none which would then read from STDIN. The problem is, i'm doing something like so:
I'd like to be able to just make FILE equal STDIN before so i don't have to fiddle around with anything in the condition of the loop. (Unless it happens to be really nice and simple to do it in the condition).foreach $file (@files) { if ((!open (FILE, "<file")) && ($file ne '-')) { #print error and die } else { while ($line = <FILE>) #OR if FILE is undefined then <STDIN> { #do something } } }
In reply to Equate File Handles? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |