Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Create a script to manipulate a flat file
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="John W. Krahn, post: 4848669"] This doesn't look like "set length data". Is that really what your data looks like? Just off the top of my head, (UNTESTED), something like this may work: my %zone_codes = ( 9000 => '09', # more zone codes here ); while ( <FILE> ) { s< ^ # start of line (\d+ # account number, house No? \D+) # street, suburb/city, state? (\d{4}) # 4 digit zip code? 000 # 3 leading zeros sprintf '%s%s%03d', $1, $2, exists $zone_codes{ $2 } ? $zone_codes{ $2 } : 0; print; } John [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Create a script to manipulate a flat file
Top