Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: File Formatting - Help required

by citromatik (Curate)
on Jun 26, 2009 at 08:22 UTC ( #774960=note: print w/replies, xml ) Need Help??


in reply to File Formatting - Help required

You can use pack:

use strict; use warnings; open(A,">Result.txt"); while (<DATA>){ chomp; my ($one,$two,$three) = split /\s+/; print A pack ("A10",$one); print A pack ("A7",$two); print A pack ("A8",$three); print A "\n"; } close(A); __DATA__ The Early Year Five New Swine

citromatik

Replies are listed 'Best First'.
Re^2: File Formatting - Help required
by Anonymous Monk on Jun 26, 2009 at 09:59 UTC
    You forgot use autodie; :)
Re^2: File Formatting - Help required
by Anonymous Monk on Jun 26, 2009 at 08:53 UTC
    Thanks a lot for your help.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://774960]
help
Chatterbox?
[GotToBTru]: whether or not it would be the best tool for that job .. that is another question
[GotToBTru]: have you looked on CPAN?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2017-02-22 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (335 votes). Check out past polls.