Bug 78235 - function 'split' affects value of variable '$1' when pattern is being used as a delimiter
function 'split' affects value of variable '$1' when pattern is being used as...
Product: Red Hat Linux
Classification: Retired
Component: perl (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Warren Togami
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2002-11-20 09:44 EST by Andrey
Modified: 2007-04-18 12:48 EDT (History)
1 user (show)

See Also:
Fixed In Version: 5.8.5-12.FC3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-28 11:32:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Andrey 2002-11-20 09:44:41 EST
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:

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 09:47:19 EST
Created attachment 85667 [details]
test script
Comment 2 Andrey 2002-11-20 09:49:23 EST
Created attachment 85668 [details]
test data
Comment 3 Warren Togami 2005-05-28 03:29:26 EDT
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 11:32:56 EDT
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.