Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2014-11-29 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls