Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and files

Status
Not open for further replies.

bmc123

Technical User
Joined
Sep 6, 2006
Messages
2
Location
IE
Hi

I'm new to perl and i'm rtying to read in a ile on one format and out put in another. the file is in fixed width format.
Can anyone point me in the right direction, as it stands i am able to read in the file and output it to a new file with no changes.



thnaks in advance
 
if it's fixed widths then simply use the substr to get the data between set positions.

my $txt = "field1 field2 field3 ";

the above is set @ 10 char positions so...

my $field1 = substr($txt,0,9);
my $field2 = substr($txt,10,19);
my $field3 = substr($txt,20,29);

to put this into a file perspective as you require try this link...
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
bmc123,

show the code you have been using.
 
got it working

thanks for your help


B
 
bmc123

Can you please show the results of your code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top