Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: how list all the files and directories?

by littlemonk (Sexton)
on Jan 06, 2014 at 19:01 UTC ( #1069570=note: print w/ replies, xml ) Need Help??


in reply to Re^2: how list all the files and directories?
in thread how list all the files and directories?

plz tell me wer im doing wrong

$path="D:/Chanti"; opendir ( DIR, $path ) || die "Error in opening dir $dirname\n"; #//print "directory contains-->@arr"; while($filename=readdir(DIR)){ print "$filename"; if (-f $filename){ push(@file,$filename); } if (-d $filename){ push(@dir,$filename); } } print "Directory--->@dir\n"; print "\n";print "\n";print "\n";print "\n";print "\n";print "\n"; print "File---->@file\n";


Comment on Re^3: how list all the files and directories?
Download Code
Re^4: how list all the files and directories?
by LanX (Canon) on Jan 06, 2014 at 19:24 UTC
    > plz tell me wer im doing wrong

    well use strict and use warnings would show you that $dirname doesn't exist.

    what else do you think is "wrong" in the result?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-05 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls