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.
:-)
In reply to Re: Using multliple formats when writing to a file
by hippo
in thread Using multliple formats when writing to a file
by rlemert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |