Bug 78235 - function 'split' affects value of variable '$1' when pattern is being used as a delimiter
Summary: function 'split' affects value of variable '$1' when pattern is being used as...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: perl
Version: 8.0
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Warren Togami
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-11-20 14:44 UTC by Andrey
Modified: 2007-04-18 16:48 UTC (History)
1 user (show)

Fixed In Version: 5.8.5-12.FC3
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-28 15:32:56 UTC


Attachments (Terms of Use)
test script (899 bytes, text/plain)
2002-11-20 14:47 UTC, Andrey
no flags Details
test data (49 bytes, text/plain)
2002-11-20 14:49 UTC, Andrey
no flags Details

Description Andrey 2002-11-20 14:44:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)

Description of problem:
I tried to match the pattern and the then split up found subpattern by 'split' 
function with pattern as a delimiter.
Function 'split' affects value of variable '$1'. This doesn't take the place on 
Red Hat 7.3 and Windows.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. execute q.pl
	

Actual Results:  MakefileData.result.dat contains '0085\000uilder.h', where 
\000 after 0085 is zero byte

Expected Results:  MakefileData.result.dat should contain 'artsbuilder.h'

Additional info:

if copy value of $1 to another variable after doing pattern match and use that 
varible in 'split' function instead of $1 then all will be correct.
##
....
if ($MakefileData =~ m/\nlibartsbuilder_la_COMPILE_FIRST\s*=\s*(.*)\n/) {
    my @compilefirst = split(/[\s\034]+/, $1); 	# @compilefirst should 
contain 'artsbuilder.h'
    print "compilefirst=@compilefirst\n";	# but contain 0085\000uilder.h, 
where \000 after 0085 is zero byte
...
###

Comment 1 Andrey 2002-11-20 14:47:19 UTC
Created attachment 85667 [details]
test script

Comment 2 Andrey 2002-11-20 14:49:23 UTC
Created attachment 85668 [details]
test data

Comment 3 Warren Togami 2005-05-28 07:29:26 UTC
Can someone test the script & data provided in this report and verify if this is
still an issue?


Comment 4 Ville Skyttä 2005-05-28 15:32:56 UTC
perl-5.8.5-12.FC3 and perl-5.8.6-15 produce the expected results.


Note You need to log in before you can comment on or make changes to this bug.