Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: parse_dir doesn't seem to work

by Cubes (Pilgrim)
on Jan 03, 2008 at 17:38 UTC ( [id://660263]=note: print w/replies, xml ) Need Help??


in reply to parse_dir doesn't seem to work

What's in $listing before you pass it to parse_dir?

What's in @directories afterwards?

(Data::Dumper may be useful here)

Replies are listed 'Best First'.
Re^2: parse_dir doesn't seem to work
by nysus (Parson) on Jan 03, 2008 at 17:43 UTC
    using data dumper, $listing is the directory listing. dumping @directories produces nothing.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

      I get the correct list returned (using 5.8.5) from parse_dir. Perhaps there's something it doesn't like about your brand of ls -l? Looks like there's a parameter to parse_dir to make it speak up on unparseable lines... does that help?
        Yeah, that's it. Getting "Can't parse" errors. Weird. Here's a typical line:
        Can't parse: -rw-r--r-- 1 root root 15264 2008- +01-03 12:46 out
        Thanks, man.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
        $nysus = $PM . $MCF;
        Click here if you love Perl Monks

        Here's what worked for me:
        $listing = `ls -l --time-style=locale`;
        Thanks to everyone who chipped in to help me. I'm grateful.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
        $nysus = $PM . $MCF;
        Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660263]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found