Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Trying to pull up all files that start with body such as:
body_data.cfm
bodyhere.txt
body_over.cfm

Please advise if this is the best way?
if ($subject eq 'body*') { print "All body pages here\n"; }

Replies are listed 'Best First'.
Re: Pulling up files starting with specific letters
by Roy Johnson (Monsignor) on May 07, 2004 at 18:10 UTC
    I think you want: @body_files = glob('body*');

    The PerlMonk tr/// Advocate
Re: Pulling up files starting with specific letters
by Sandy (Curate) on May 07, 2004 at 18:14 UTC

    'body*' is a string that has a 'star' in it. It certainly is not a wild card.

    you must use 'matching' with regular expressions.

    if ($subject =~ /^body/) { # do something }
    I suggest you scan the docs for how this all works, or check out some of the tutorials.

    Have fun.