Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How to read directories from the text file using perl?

by poj (Abbot)
on Mar 23, 2017 at 07:09 UTC ( [id://1185560]=note: print w/replies, xml ) Need Help??


in reply to How to read directories from the text file using perl?

I couldnt make the correct code for the above requirements
#!/usr/bin/perl; use strict; # I have the text file named as data.txt. my $infile = 'data.txt'; # Now i like to read the line from data.txt open IN,'<',$infile or die "$!"; print "Reading from '$infile'\n"; my $dir; while (<IN>){ chomp; # in which the line # starts with ZERO # contains the directory path? if (/^ZERO:(.*)/){ $dir = $1; } } close IN; print "Directory is '$dir'\n";

What's the problem, which part couldn't you do ?

poj

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found