Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Seeking fixed length

by jeroenes (Priest)
on Jul 05, 2001 at 22:01 UTC ( #94188=note: print w/ replies, xml ) Need Help??


in reply to Seeking fixed length

There is more to comma-delimiting than meets the eye. See Text::xSV and DBD::CSV. But in general:

while( <> ){ split /,/; print pack 'A10'x (scalar @_), @_; }
Run it as perl convert.pl <input.txt >output.txt

See the docs for while, split and pack. You can accomplish similar things with sprintf (as pack stuff is pretty complicated if you're not used to perl). You might wanna check perldata and perlvar as well.

Hope this helps,

Jeroen
"We are not alone"(FZ)
Updated, typo fixed thanks particle.


Comment on Re: Seeking fixed length
Select or Download Code
Re: Re: Seeking fixed length
by particle (Vicar) on Jul 05, 2001 at 22:06 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-12-20 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls