Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: file listing within skript not working

by McSvenster (Novice)
on Jan 30, 2013 at 11:04 UTC ( #1016031=note: print w/replies, xml ) Need Help??

in reply to Re: file listing within skript not working
in thread file listing within skript not working

Thanks a lot for Your help! I'll ask our server-admins about selinux. I am pretty sure you are right. When I changed the script to

my @files = glob "$datenDir/*.xml";
it does not even write anything into the logfile. So I think the listings within scripts might be forbidden.

And thanks for directing me to "glob". Don't know why I didn't use it - I think I need something to drink :-)

Replies are listed 'Best First'.
Re^3: file listing within skript not working
by vinoth.ree (Monsignor) on Jan 30, 2013 at 11:42 UTC

    Well said moritz ++

    McSvenster Perl has many ways to do things,you can also use readdir() function this way,

    use strict; use warnings; use Data::Dumper; opendir (DIR, "/home/vinoth/"); my @files = grep /\.xml$/, readdir DIR; print Dumper \@files;

    I am not telling this is the best way, but its also one of the way.

      It's getting more and more confusing for me...

      But maybe I found the critical point: When I use the backticks perl writes to the logfile until the program comes to the line with the backticks. But when I use "glob" instead, perl executes the whole program before it performs any file-writing.

      Is this right? And more important: Can you explain it to me? (you see, I am a beginner...)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016031]
[ambrus]: "Corion Meh. My bank removed (part of) their CSV download facilities." => ah great. interface changes.
[ambrus]: Is this for work?
[Eily]: Discipulus try looking at $@
[Eily]: or count the parentheses :)
[Discipulus]: stupid me! I had to stay at home and do not code with the flu..
[holli]: bacause it's a syntax error
[Discipulus]: yes sorry forget and forgive me

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-10-24 10:13 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (287 votes). Check out past polls.