Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: how to store text file information into my sql database

by mr_ron (Chaplain)
on Dec 28, 2015 at 20:47 UTC ( [id://1151288]=note: print w/replies, xml ) Need Help??


in reply to Re^2: how to store text file information into my sql database
in thread how to store text file information into my sql database

There is a CPAN module DataExtract::FixedWidth for handling the fixed unpacking details. I tried it on the test sample and it seems to work fine.

use strict; use warnings; use DataExtract::FixedWidth; use Data::Dumper; my $de = DataExtract::FixedWidth->new({ header_row => scalar(<DATA>) }); while (my $l = <DATA>) { my $fields = $de->parse($l); print Dumper($fields); } __DATA__ StudentId Name Dept address city 1 Chellappa CSE 22 xx-colony 2nd street coimbatore 2 Vijay IT 23 yy colony coimbatore
Ron

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 19:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found