Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: basic question:how to print a reversed array from STDIN

by poolpi (Hermit)
on Dec 05, 2008 at 08:33 UTC ( [id://728226]=note: print w/replies, xml ) Need Help??


in reply to Re^2: basic question:how to print a reversed array from STDIN
in thread basic question:how to print a reversed array from STDIN

Dear ikegami,

I had never have the intention to submit this little piece of code to Perl 6 core modules...

For me, it was just a funny variation on chomp.

To be constructive, please give some examples because i can't reproduce two of your three remarks

Laziness, impatience, hubris and why not humility.

hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Replies are listed 'Best First'.
Re^4: basic question:how to print a reversed array from STDIN
by ikegami (Patriarch) on Dec 05, 2008 at 10:37 UTC
    I use an in-memory file, but a real file will do just as well.
    { my $f; { open(my $fh, '>', \$f) or die $!; print $fh "abc"; } { open(my $fh, '<', \$f) or die $!; chop( $_ = <$fh> ); print chop while $_; # ba print"\n"; } } { my $f; { open(my $fh, '>', \$f) or die $!; print $fh "012\n"; } { open(my $fh, '<', \$f) or die $!; chop( $_ = <$fh> ); print chop while $_; # 21 print"\n"; } }

Log In?
Username:
Password:

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

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

    No recent polls found