in reply to Multiple commands separated by commas
If there are multiple parts, put () around the comma parts(eg (part1), (part2,)) and it will parse like you expect.
Another what I think is better coding (don't use the comma if not needed):#!usr/bin/perl -w use strict; for my $i (1..9) { (print "Next"), next if $i == 5; print $i } __END__ Output: 1234Next6789
The basic thing with the comma operator, is that what appears in the last part of the comma statement is what matters.#!usr/bin/perl -w use strict; for my $i (1..9) { if ($i == 5) { print "Next"; next; } print $i; } __END__ Output: 1234Next6789
|
|---|