http://qs321.pair.com?node_id=1112717


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!