Bug 519048 - perl file glob fails
Summary: perl file glob fails
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-08-24 18:00 UTC by Joe Smith
Modified: 2009-08-25 12:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-25 12:13:03 UTC


Attachments (Terms of Use)

Description Joe Smith 2009-08-24 18:00:59 UTC
Using perl on f11 (perl-5.10.0-73.fc11.i586).

Perl's file glob is supposed to handle shell-style filename globs, including negated character classes, but it seems to be not quite right:

$ (cd /lib; perl -e 'print("$_\n") for <[Mm]*>')
modules
multipath

$ (cd /lib; perl -e 'print("$_\n") for <[^Mm]*>')
modules
multipath

The character class and its negation give exactly the same result.

Testing the same patterns in the shell gives the same 2 matches for the first pattern, 180 for the negated class, and 182 for everything in /lib.

Comment 1 Marcela Mašláňová 2009-08-25 12:13:03 UTC
The correct negation could be "!"
$ (cd /lib; perl -e 'print("$_\n") for <[!Mm]*>')
This command is working as you thought. I suppose ^ is for beginning of the line.

Comment 2 Joe Smith 2009-08-25 12:44:18 UTC
Oops--you're absolutely right. I guess the '!' is the standard shell pattern; I'm so used to bash accepting "^" I forgot about the other.

Thanks for the clue.

Please close.


Note You need to log in before you can comment on or make changes to this bug.