Perl Programming | ||
---|---|---|
String Context | ||
my $string; my $number; # Empty string in string context $string = $number . 17; # Concatenate print "String is '$string'\n"; $number = 5.2; # "5.2" in string context $string = $number . 17; print "String is '$string'\n"; $number = 5.2; $string = sprintf("%.2f", $number); # Formatting print "String is '$string'\n"; String is '17' String is '5.217' String is '5.20' |
||
Previous | http://stuff.mit.edu/iap/perl/ | Next |