I am running perl in a DOS window on a PC running Windows ME.
The following code displays on the CRT in the font and size called out when script was invoked (perl program.pl -font "Courier 16"):
foreach $play (@ranked) {
if (($play->{track} ne '') && ($play->{track} ne 0)){
$title = pack("A32", "$play->{title}");
$artist = pack("A32", "$play->{artist}");
$album = $play->{album};
$track = $play->{track};
if(length($track) == 1){
$track = '0'.$track;
}
$listbox->insert('end',
"$title$artist$play->{album}-$track");
}
}
When I need to put the same information to a file, I use:
open(REPORT, ">report.dat") || die("Can't open output file");
@ranked = sort by_artist @hash;
foreach $play (@ranked) {
if($play->{track} != 0) {
$title = $play->{title};
$artist = $play->{artist};
$album = $play->{album};
$track = $play->{track};
if(length($track) == 1){
$track = '0'.$track;
}
write REPORT;
}
}
close(REPORT);
When I examine the file report.dat, it contains text only. How do I generate a file containing text and fonts, size, etc.? or How can I send this to the local printer along with font, size, etc.?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.