Hi Pam. See in-line.

"Pam Derks" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm having difficulties with @ARGV...
>
> I have a several files:
> access_log.021204
> access_log.021205
> access_log.021206
>
> that I want to read in using @ARGV
>
> and then pass these file names to 2 subroutines
>
> At the command line I've tried:
> myprogram.pl access*
>
> myprogram.pl
> get_file(@ARGV)
> get_match(@ARGV)
>
> I've got two questions:
> is it possible to use wildcards with @ARGV?

You can use anything you like in ARGV, but Perl won't assume anything about
the parameters. To do file globbing you have to say:

    @files = glob ($ARGV[0]);

or, if you expect mutiple wildcarded filenames:

    @files = ();
    push @files, glob foreach @ARGV;

> How do I pass @ARGV to these 2 subdirecoties?
>

Exactly as you have written, which is fine, although depending on what
you're doing you may want to expand the wildcards as above and then:

    get_file(@files);
    get_match(@files);

which you can then access within the subroutine as:

sub get_file
{
    my @files = @_;
    :
}

>
> Thanks in advance for any help,

Welcome :)

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to