Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: formats output \r\n question

by shmem (Chancellor)
on Jun 27, 2006 at 16:07 UTC ( [id://557833]=note: print w/replies, xml ) Need Help??


in reply to Re^2: formats output \r\n question
in thread formats output \r\n question

Darn. Well, TIMTOWTDI.

You could do:

#!/usr/bin/perl -w use strict; my $name = 'name'; my $home = "town"; my $form = "\@<<<<<<<<<<<<<<<<<< \@<<<<<<<<<<<<<<<\r\n"; formline($form, $name, $home); print $^A;
See perlvar, formline for fiddling with the formats. But maybe it would be just easier to postprocess?
#!/usr/bin/perl -w use strict; my $name = 'name'; my $home = 'town'; printknecht(); # let's fork us a scribe write; format STDOUT = @<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<< $name, $home . sub printknecht { return if my $pid = open(STDOUT, "|-"); # return if parent. die "cannot fork: $!" unless defined $pid; while (<STDIN>) { chop; print $_."\r\n"; } exit; }
See Playing with STDIN and STDOUT for some prosa around this technique.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-20 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found