PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Jim Anderson <jander at ml dot com>
Subject: Re: ARGV in NT
Date: Oct 22 1997 1:22PM

Lhoir Sebastien sagely stated:
> At 09:45 21/10/97 -0400, you wrote:
> >
> >
> >
> >
> >
> >Sherry Lee@METLIFE
> >10/21/97 09:45 AM
> >
> >I am porting a sybperl script from UNIX to NT. The script runs fine in UNIX
> >but when executed in NT 4.0, the script does not pick up on the ARGV values
> >($ARGV[0], $ARGV[1], etc).
> >
> >$ARGV[0] comes in as blank and $#ARGV is set to -1 instead of 1.
> >
> >Do I need to define the ARGV differently on NT ?
> >
> >Thanks for any suggestions.
> >Sherry
> >
> >
> I ported sybperl scripts from UNIX to NT and I don't have any problem with ARGV.
> I am using it like this :
> 
> for $x (0..$#ARGV) {
>         if ($ARGV[$x] eq "-C") { &do_something() }
> }

Here's an alternate, and somewhat more concise (some would say more
elegant :) solution:

for (@ARGV) {
   do_something() if $_ eq "-C";
}

> ---------------------------------------------------------------------
> LHOIR Sebastien                         E-Mail : lhoir@chex.ucl.ac.be
> Cliniques Universitaires Saint-Luc      Tel    : 32-2-7641452
> 10 Av. Hippocrate                       Fax    : 32-2-7623680
> B-1200 BRUXELLES (BELGIUM)
> ---------------------------------------------------------------------
> 
> 
> 
-- 
Jim Anderson			jander@ml.com
Consultant-at-large		jander@jander.com
				(212) 449-1598