SPUG: Trouble with -F: on shebang line

Tim Maher/CONSULTIX tim at consultix-inc.com
Mon Jun 12 22:28:15 CDT 2000

Although this script works correctly, which tells me that split's RE
is not really :\n, but rather the : I asked for, it bothers me that
it's showing the wrong RE!!  Presumably, it's grabbing the \n that
follows the shebang line and tagging that onto the : argument to the
-F.  I tried to put the -F argument earlier in the sequence, but
then the Deparse output doesn't show me anything but my original
program!  I also tried putting quotes or //'s around the :, but
that gave me syntax errors.  Anybody know what's going on here?
Anybody know how to get Deparse to show the correct RE for this

#! /usr/bin/perl -wna -F:

BEGIN { @ARGV  or  @ARGV='/etc/passwd'; }

# show field one, which is user logname
print "$F[0]\n" ;


P.S. On a flight to Silicon Valley last Tuesday, I sat next
to an elderly couple returning from the PerlWhirl "inside-passage" cruise
(not geeks, just on same ship), who remarked that the Perl Whirlers
looked very scruffy during the day in their jeans, but "like angels"
at night in their tuxedos! 8-}  As a catholic-school refugee who still
has nightmares about showin up "out of uniform", I personally revolt at
the idea of any dress code, but there's no disputing the fact that women of
a certain age are suckers for an over-dressed man! 

Wish it were otherwise . . .

| Dr. Tim Maher, CEO, Consultix       (206) 781-UNIX/8649;  ask for FAX# | 
| Email: tim at consultix-inc.com        Web: http://www.consultix-inc.com  |
| CLASSES; 6/12: Int. Perl  6/15: Pat. Matching  8/14: UNIX  8/21: Shell |
| DAMIAN CONWAY Seminars;  Adv. OO Perl: 7/6,  Parsing with Modules: 7/7 |

$ cat /tmp/show
#! /usr/bin/perl -wna -F:

BEGIN { @ARGV  or  @ARGV='/etc/passwd'; }

# show field one, which is user logname
print "$F[0]\n" ;

$ perl -MO=Deparse,-a /tmp/show
/tmp/show syntax OK
Use of uninitialized value at /usr/lib/Perl5/5.00502/i586-linux/B/Deparse.pm line 1142.
LINE: while (defined($_ = <ARGV>)) {
    @F = split(/:\n/, $_, 0);
    print "$F[0]\n";

$ /tmp/show | head -3

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address

More information about the spug-list mailing list