Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

file handling

by ashish_sun123 (Initiate)
on Aug 17, 2011 at 20:44 UTC ( [id://920795]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Please tell
in thread Please tell

Hi Monks,

I have one file which contains a header and rest details. Now I have to read the file header. There are around 30 fields in the header and each separated by "|".

There will be a fixed pattern in the header "LASTUPDATE" , I need to find out the position of this in the header.

Now after taking the position of this fixed pattern , I need to read the subsequent second line from the file and take out the date field which will be in the same position.

My question is that

in file reading if I am reading the file from the very first line can I refer the first line as line[0] and then the second line as line1

I will read the first line and assign it to an array and then I will match the pattern and take the position of that element.

Then I will read the second line as line1 and then again assign it to a new array and then read the position as got from first line.

Kindly advice

Replies are listed 'Best First'.
Problem in file name generation (was Re^5: Please tell)
by parv (Parson) on Aug 17, 2011 at 20:54 UTC
    Post the shortest possible offending code section that shows how a file name is generated, as has been asked, among other things, of you multiple times already.
      my($filename1, $directories) = fileparse($file1); print "directory is --> " . $directories; print "filename1 is --> " . $filename1;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found