Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Using multliple formats when writing to a file

by hippo (Curate)
on Jun 06, 2014 at 17:01 UTC ( #1089068=note: print w/ replies, xml ) Need Help??


in reply to Using multliple formats when writing to a file

Using FileHandle as recommended in the perlform documentation works for me:

#!/usr/bin/perl -w use strict; use warnings; use FileHandle; open my $fh, '>', '/tmp/output.txt' or die $!; my $data = 'This is a test'; format LEFT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $data . format RIGHT = @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $data . format_name $fh "LEFT"; write ($fh) or die $!; format_name $fh "RIGHT"; write ($fh) or die $!; close ($fh) or die $!; exit;
Please note in your answers I'm not a programmer - I'm an engineer who simply uses perl to make my life easier.

The easier you want your life to be, the more you will use perl and therefore the more you will become a programmer.

:-)


Comment on Re: Using multliple formats when writing to a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-09-01 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (17 votes), past polls