Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Using wildcards to open files.

by frozenwithjoy (Priest)
on Oct 25, 2012 at 21:10 UTC ( #1000942=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using wildcards to open files.
in thread Using wildcards to open files.

That's causing your problem. You are only using the chunk before the first space for each file.

I haven't had a chance to test this in your exact usage situation, but try the following. It replaces spaces in the file names with escaped spaces.

#!/usr/bin/perl @files = glob("*.msg"); foreach $file(@files) { $file =~ s/ /\\\ /g; $cmd = "perl script.pl < $file"; system($cmd); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000942]
help
Chatterbox?
[sierpinski]: why is it the last index and not the first? because the length of the array becomes the index?
[sierpinski]: thanks LanX that helps
[haukex]: the first index is always 0 - $#array gives you the last index in @array
[sierpinski]: gotcha, thanks
[LanX]: length = last index +1

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2017-12-13 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (369 votes). Check out past polls.

    Notices?