The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

i'm gonna kick myself by nimdokk 2002-06-20 15:30:24
i'm writing up a short perl prog to scan a file and return a pagecount. i specify the file on the commandline. I need to access that filename at the end of the program, what is the default variable for that commandline argument?

#!/usr/bin/perl -w
use strict;
my $pages=0;
foreach (<>) {$pages++ if /\014/;}
print "$ARGV[0] has $pages page(s).\n";

I know that the default variable is not $ARGV[0] but I'm trying to remember what I should include there which will give me the name of the file on which I'm running this prog. Thoughts? I'm reading the Camel book to find the answer at the moment I should know this but simply can't remember at the moment.
[ Reply ]
  further info by nimdokk2002-06-20 15:42:57
    ok by nimdokk2002-06-20 16:06:46
      I've experienced this before by Kickstart2002-06-20 16:58:10
        ok - at least i'm not losing it :) by nimdokk2002-06-20 17:07:34
          nah, you already lost it ;) by ma petite2002-06-20 19:25:59
        It has to dowith the use of <>, not the loop. by inittab2002-06-20 22:43:50
          well by nimdokk2002-06-20 23:23:39
  No! by Naruki2002-06-20 20:15:06

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)