Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 ( #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? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-12-07 19:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?