Oops, sorry I got tied up here and forgot I was going to send you more
info.  Basicly what you need to do is this:

my $query = "
        select this, that
                from table
                where constant_where_clause_stuff = other constant_stuff
";

$option = @ARGV ? " and filename = $ARGV[0] " : " ";

$query .= $option . " group by whatever sort by whatever";

$sth = $dbh->prepare($query);

$sth->execute;

.
.
.
etc.

On 05 Jul 2001 13:47:14 -0400, Kim Green wrote:
> I don't know how or where to put & how to use this $option.  
> What if my Default value is a sql statement? Can I just include the name 
> of the file handle between the brackets?
> 
> 
> 
> -----Original Message-----
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 29, 2001 6:40 PM
> To: M.W. Koskamp
> Cc: Evgeny Goldin (aka Genie); [EMAIL PROTECTED]
> Subject: Re: Optional Variables
> 
> 
> On Fri, 29 Jun 2001, M.W. Koskamp wrote:
> 
> 
> > > my $option = @ARGV ? shift : <DEFAULT VALUE>;
> >
> > Above option only works for 1 parameter tho (and commandline arguments).
> > For function calls i like to use 'named parameters' by accepting a hash of
> > options.
> 
> Well, yeah, but the topic *was* command-line arguments, not function
> arguments.  You can easily loop through @ARGV, unshifting as you go, until
> @ARGV is depleted and default values assigned.
> 
> -- Brett
>                                  http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> A free society is one where it is safe to be unpopular.
>               -- Adlai Stevenson
> 
--
Today is Sweetmorn, the 40th day of Confusion in the YOLD 3167
Pzat!


Reply via email to