Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
No such thing as a small change
 
PerlMonks  

Re^2: How to read files in a directory, directory path to be given through CMD

by ckj (Hermit)
on Jun 11, 2012 at 19:12 UTC ( #975618=note: print w/ replies, xml ) Need Help??


in reply to Re: How to read files in a directory, directory path to be given through CMD
in thread How to read files in a directory, directory path to be given through CMD

Sorry, but have you run your code? I ran it and on entering path name after running my perl script it says :

C:\Perl64\bin>perl t1.pl C:\Perl64\bin Can't do inplace edit: C:\Perl64\bin is not a regular file at t1.pl li +ne 20.


Comment on Re^2: How to read files in a directory, directory path to be given through CMD
Download Code
Re^3: How to read files in a directory, directory path to be given through CMD
by kennethk (Monsignor) on Jun 11, 2012 at 19:23 UTC
    Ahh, so you do not intend STDIN, but rather @ARGV for your input. In that case, you might use
    use strict; use warnings; foreach my $file (@ARGV) { if (-f $file) { print "This is a file: $file\n"; } if (-d $file) { print "\n\nThis is a directory: $file\n"; } }

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re^3: How to read files in a directory, directory path to be given through CMD
by BrowserUk (Pope) on Jun 11, 2012 at 20:10 UTC
    Can't do inplace edit: C:\Perl64\bin is not a regular file at t1.pl line 20.

    How can you possibly be getting a error on line 20 of kennethk's code, when neither version of the code he posted has 20 lines?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2013-05-21 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (431 votes), past polls