Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I was just learning about formats and I was wondering if you could explain why the header in the code below displays in the file but not at the console
thanks# open up MYFILE for writing open(MYFILE,">myfile.txt") or die "Can't open up myfile: $!\n"; my ($name,$age, $salary) = ('girl', '21', '12'); # now this line format will automatically apply to MYFILE format MYFILE = @>>>>>>>>>>>>>>>>>>>>>>>>>>>> @>>>>>>>>>>>>>> $name, $salary . format MYFILE_TOP = ----------------------------------- Name Salary ----------------------------------- . write MYFILE; select(STDOUT); $~ = "MYFILE"; write; #write to STDOUT
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: format header not displayed at STDOUT
by jethro (Monsignor) on Dec 30, 2010 at 15:54 UTC | |
by Anonymous Monk on Dec 30, 2010 at 17:47 UTC |