vsespb has asked for the wisdom of the Perl Monks concerning the following question:
prints the following:#!/usr/bin/perl use strict; use warnings; my $errors = undef; sub ok { my( $test, $name ) = @_; print "[[[$test]]] [[[$name]]]\n"; }; ok( ($errors && ($errors->[0] =~ /Journal file not found/i)), "some te +xt 1 $errors->[0]" ); ok( ($errors && ($errors->[0] =~ /Journal file not found/i)), "some te +xt 2 $errors->[0]" );
and by the way this code (with modified 'some text' strings)Use of uninitialized value in concatenation (.) or string at poc.pl li +ne 14. [[[ARRAY(0x137cd48)]]] [[[some text 1 ]]] Use of uninitialized value in pattern match (m//) at poc.pl line 15. Use of uninitialized value in concatenation (.) or string at poc.pl li +ne 15. Use of uninitialized value $name in concatenation (.) or string at poc +.pl line 11. [[[some text 2 ]]] [[[]]]
prints correct result:#!/usr/bin/perl use strict; use warnings; my $errors = undef; sub ok { my( $test, $name ) = @_; print "[[[$test]]] [[[$name]]]\n"; }; ok( ($errors && ($errors->[0] =~ /Journal file not found/i)), "some te +xt 1" ); ok( ($errors && ($errors->[0] =~ /Journal file not found/i)), "some te +xt 2" );
perl 5.10.1 under LinuxUse of uninitialized value $test in concatenation (.) or string at poc +.pl line 11. [[[]]] [[[some text 1]]] Use of uninitialized value $test in concatenation (.) or string at poc +.pl line 11. [[[]]] [[[some text 2]]]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl bug ?
by choroba (Cardinal) on Feb 06, 2013 at 11:54 UTC | |
by vsespb (Chaplain) on Feb 06, 2013 at 11:58 UTC | |
by vsespb (Chaplain) on Feb 06, 2013 at 12:06 UTC | |
by tinita (Parson) on Feb 06, 2013 at 12:31 UTC | |
by vsespb (Chaplain) on Feb 06, 2013 at 12:36 UTC | |
by tinita (Parson) on Feb 06, 2013 at 12:48 UTC | |
| |
by choroba (Cardinal) on Feb 06, 2013 at 12:13 UTC | |
by tinita (Parson) on Feb 06, 2013 at 12:42 UTC | |
by choroba (Cardinal) on Feb 06, 2013 at 12:46 UTC | |
by vsespb (Chaplain) on Feb 06, 2013 at 12:18 UTC | |
by choroba (Cardinal) on Feb 06, 2013 at 12:35 UTC | |
| |
|
Re: Perl bug ?
by Corion (Patriarch) on Feb 06, 2013 at 12:38 UTC | |
by vsespb (Chaplain) on Feb 06, 2013 at 15:53 UTC | |
|
Re: Perl bug ?
by salva (Canon) on Feb 06, 2013 at 11:57 UTC |