Loginskip to content

October 31st, 2006

my %port = (http => 80, https =>

assigned the one’s complement of the result of this substitution on $_ (which in a scalar context is the number of substitutions made).” 10.3.1 Flashback Remember in Chapter 8 we wondered why Perl placed the error with the transposed for clauses on the wrong line? Now we know how to find out! $ perl -MO=Deparse temp.pl Useless use of numeric lt (<) in void context at temp.pl line 13. my $fmt = '%10s ' x 5; printf "$fmtn", qw(Kelvin Celsius Rankine Fahrenheit Reaumur); $fmt = '%10.2f ' x 5; my $kelvin = 0; while ($kelvin += 10) { my $celsius = $kelvin - 273.15; my $rankine = $kelvin * 9 / 5; my $fahrenheit = $rankine - 459.67; my $reaumur = $celsius * 4 / 5; printf "$fmtn", $kelvin, $celsius, $rankine, $fahrenheit, $reaumur; } continue { $kelvin < 500 } Well, look at that. The dirty truth about for loops emerges: they're nothing but while loops in fancy clothes. The test clause got relocated to a continue block, where, of course, it makes no sense, being an expression in void context. 10.4 printf Formats Don't Impose Context If you're a die-hard C programmer (and is there any other kind?), you might think that to print the number of entries in an array, since the %dprintfformat specifier means "number," well gosh, a number is a scalar, and so that's the context it'll put its argument into: printf "Number of entries in @foo = %d", @foo; but by now you know us too well to fall for that yes, @foo is in list context here, because that's what printf is prototyped to take. So you'll either get the first entry of @fooprinted, or a complaint if that's not a number. 10.5 Conditional my
Note: If you are looking for high quality webhost to host and run your jsp application check Vision jsp hosting services

Comments are closed.