Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

$sum += $_ ** 3 for 1..9

by LanX (Saint)
on Dec 31, 2024 at 13:14 UTC ( [id://11163457]=perlmeditation: print w/replies, xml ) Need Help??

say "Happy new year $sum!!! :)"

Best obfuscated wishes! ;)
- Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re: $sum += $_ ** 3 for 1..9
by choroba (Cardinal) on Dec 31, 2024 at 17:35 UTC
    $s += $_ for 1 .. 9; say 'Happy ', $s ** 2, ' to you, too!'
    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Cool and this equivalence is true for any sequence 1..n .

      ( Not very hard to prove :)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

Re: $sum += $_ ** 3 for 1..9
by Arunbear (Prior) on Jan 01, 2025 at 11:43 UTC
    To save some typing:
    perl -E '$sum += $_ ** 3 for 1..9; say "¡Próspero año $sum!"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://11163457]
Approved by jo37
Front-paged by jo37
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2025-07-09 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.