Hi, following Ben Morrow and Christopher Nehren's suggestions, I eliminated the single quotes in the keys used to access hash %foo in the example. The modifications can be found in the same repository/branch as before: http://github.com/polettix/perl/tree/modern > git@github.com:polettix/perl.git branch modern > > Each change comes with a commit of its own, in order to better document it > all: > > http://github.com/polettix/perl/commits/modern/ > Moreover, I'm putting the whole diff at the end of this email for ease of discussion. Cheers, Flavio. diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 59f268e..5bd29b9 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -243,10 +243,10 @@ dangling statements allowed. If you want to write conditionals without curly brackets there are several other ways to do it. The following all do the same thing: - if (!open(FOO)) { die "Can't open $FOO: $!"; } - die "Can't open $FOO: $!" unless open(FOO); - open(FOO) or die "Can't open $FOO: $!"; # FOO or bust! - open(FOO) ? 'hi mom' : die "Can't open $FOO: $!"; + if (!exists $foo{BAR}) { die "No BAR in %foo"; } + die "No BAR in %foo" unless exists $foo{BAR}; + exists $foo{BAR} or die "No BAR in %foo"; # $foo{BAR} or bust! + exists $foo{BAR} ? 'hi mom' : die "No BAR in %foo"; # a bit exotic, that last one The C<if> statement is straightforward. Because BLOCKs are always @@ -496,6 +496,7 @@ block is optional. The BLOCK construct can be used to emulate case structures. + # Don't use this from perl 5.10 on, use feature "switch" instead SWITCH: { if (/^abc/) { $abc = 1; last SWITCH; } if (/^def/) { $def = 1; last SWITCH; } @@ -841,7 +842,7 @@ and your documentation text freely, as in =cut back to the compiler, nuff of this pod stuff! - sub snazzle($) { + sub snazzle { my $thingie = shift; ......... }Thread Previous | Thread Next