From: Adrian M. Enache Date: Fri, 14 Mar 2003 23:02:42 +0000 (+0200) Subject: Re: [fix] [perl #21575] Bug with print( followed by a newline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a202259b5c58b8852cda4ec492b88e9baff32c6;p=p5sagit%2Fp5-mst-13.2.git Re: [fix] [perl #21575] Bug with print( followed by a newline Message-ID: <20030314210242.GA1159@ratsnest.hole> (with an added test) p4raw-id: //depot/perl@18986 --- diff --git a/t/comp/parser.t b/t/comp/parser.t index ad1c5b8..54ad351 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } require "./test.pl"; -plan( tests => 20 ); +plan( tests => 21 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -88,3 +88,12 @@ is( $@, '', 'PL_lex_brackstack' ); ${a}{ ${a}[ @{b}{ ${a}{ } + +# Bug #21575 +# ensure that the second print statement works, by playing a bit +# with the test output. +my %data = ( foo => "\n" ); +print "#"; +print( +$data{foo}); +pass(); diff --git a/toke.c b/toke.c index 4e5a977..1b6baaa 100644 --- a/toke.c +++ b/toke.c @@ -3088,6 +3088,7 @@ Perl_yylex(pTHX) PL_oldbufptr = PL_oldoldbufptr; /* allow print(STDOUT 123) */ else PL_expect = XTERM; + s = skipspace(s); TOKEN('('); case ';': CLINE;