in reply to Using * character to open all Files in the directory

You haven't mentioned what you've already tried but I assume you know that @ARGV can be your friend. Very simple example:
#!/usr/bin/perl -w use strict; for (@ARGV) { # do stuff }
-- vek --

Replies are listed 'Best First'.
Re: Re: Using * character to open all Files in the directory
by Kanji (Parson) on Jul 05, 2002 at 22:59 UTC

    The c:\> in Prayag's post gives us a good indication that they're doing this in a Windows (or DOS) environment, which (by default) doesn't expand asterisks, etc. (aka "shell globbing").

    Instead, you need to all such expansion yourself, with something like...

    my @files; push @files, glob foreach @ARGV;

    ... which breaks as soon as you want to open a file containing an asterisk or other expansion character.

    Anyhoo, for further discussion, see the recent portable globbing behavior for command-line tool.

        --k.


      FWIW, I haven't found a way of creating a filename with an embedded wildcard char yet.

      This may be possible under *nix, but I wonder what would stop the shell from trying to expand it everytime someone tried to use it? Showing my ignorance of *nix stuff again.

        Yes Windows forbids the use of numerous characters including several non while cards such as : and '. In UN*X you escape the wild character to protect it, same idea as in Perl.

        --
        perl -pew "s/\b;([mnst])/'$1/g"

      Kanji++ You're right of course, I must admit that in my haste I did not notice the C:\>.

      Cheers.

      -- vek --