Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

a prime bug

by ownlifeful (Beadle)
on Jun 10, 2017 at 21:24 UTC ( #1192502=poem: print w/replies, xml ) Need Help??

chomp and print join ',', grep $_, (map length, split /[a,]/), "\n" while <DATA>; __END__ a bug trapped inside a paper lantern, arid aflutter, ablaze

Replies are listed 'Best First'.
Re: a prime bug
by shmem (Chancellor) on Jun 11, 2017 at 07:41 UTC

    Nice. But __END__ should be __DATA__ and __END__ be -- well, at the end.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      I suppose, if you want to be formal about it.
      iirc, __END__ and __DATA__ are equivalent, and that's why the script runs. Please correct me if you know otherwise.

        Running a script - perl script.pl - the tokens make no difference. But if you invoke perl on the command line to read STDIN and paste the script, __END__ makes DATA into STDIN, and you have to type Ctrl-d to close STDIN/DATA. Not a big deal, but that's the difference ;-)

        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      All comments so far are awesome. I felt like the bug when i read it ... ;]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2023-03-24 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (61 votes). Check out past polls.

    Notices?