in reply to Question about Perl man pages
package perlop; use base qw(Term::Shell); my $obj = perlop->new(); $obj->cmdloop; use strict; use warnings; sub prompt_str { my $cwd = 'cwd'; $cwd =~ s[^\Q$ENV{HOME}\E][~]; "perlop> "; } sub run_comma { print <<"EOF"; Binary "," is the comma operator. In scalar context it evaluates its l +eft argument, throws that value away, then evaluates its right argume +nt and returns that value. This is just like C's comma operator. In list context, it's just the list argument separator, and inserts bo +th its arguments into the list. These arguments are also evaluated fr +om left to right. The => operator is a synonym for the comma except that it causes its l +eft operand to be interpreted as a string if it begins with a letter +or underscore and is composed only of letters, digits and underscores +. This includes operands that might otherwise be interpreted as opera +tors, constants, single number v-strings or function calls. If in dou +bt about this behaviour, the left operand can be quoted explicitly. Otherwise, the => operator behaves exactly as the comma operator or li +st argument separator, according to context. EOF print "\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Question about Perl man pages
by JavaFan (Canon) on Jul 08, 2010 at 12:01 UTC |