perl 3.0 patch #12 patch #9, continued
[p5sagit/p5-mst-13.2.git] / eg / rename
index 1708d35..1bb19d7 100644 (file)
--- a/eg/rename
+++ b/eg/rename
@@ -1,9 +1,14 @@
 #!/usr/bin/perl
 
 ($op = shift) || die "Usage: rename perlexpr [filenames]\n";
-if ($#ARGV < 0) {
-    @ARGV = <stdin>;
-    chop(@ARGV);
+if (!@ARGV) {
+    if (-t) {
+       @ARGV = <*>;
+    }
+    else {
+       @ARGV = <STDIN>;
+       chop(@ARGV);
+    }
 }
 for (@ARGV) {
     $was = $_;