Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Different way to use while loop

by Krambambuli (Curate)
on Jan 09, 2015 at 09:41 UTC ( #1112717=note: print w/replies, xml ) Need Help??


in reply to Different way to use while loop

The following code should illustrate the difference:

#!/usr/bin/perl $_ = "Foollll\nFoollll\n"; 1 while s/^Fool/Foo/g; print "1:\n\n$_"; print "\n\n"; $_ = "Foollll\nFoollll\n"; s/^Fool/Foo/g; print "2:\n\n$_";

Can you see what the output will be...? ;)


Krambambuli
---

Replies are listed 'Best First'.
Re^2: Different way to use while loop
by ChuckP (Novice) on Jan 14, 2015 at 02:40 UTC

    Howdy!

    Thanks for the info and examples! I read perlop and perlre years ago, but don't recall seeing the 1 while example(s).

    Thanks Again!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2019-11-15 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (84 votes). Check out past polls.

    Notices?