Bug 124259 - Perl chop gives only new lines in output
Summary: Perl chop gives only new lines in output
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Chip Turner
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-05-25 08:56 UTC by Tomi Malkki
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-05-25 18:31:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Tomi Malkki 2004-05-25 08:56:06 UTC
Description of problem:
WORKS
#!/usr/bin/perl
open(RPMS, "ls /home/tomi/*.rpm |");
@packages = [];
for ($i = 0; $line = <RPMS>; $i++) {
	chop($line);
	@packages[$i] = $line;
}
close(RPMS);

print @packages;

-----------------------------------------

ONLY NEW LINES IN OUTPUT
#!/usr/bin/perl
open(RPMS, "ls /home/tomi/*.rpm |");
@packages = [];
for ($i = 0; $line = <RPMS>; $i++) {
	@packages[$i] = chop($line);;
}
close(RPMS);

print @packages;

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

How reproducible:
Always

Steps to Reproduce:
Example code
  

Actual Results:  Only new lines in output

Expected Results:  Should have file list.

Comment 1 Suzanne Hillman 2004-05-25 18:31:10 UTC
According to what I understand about how chop works, that is expected
behavior.

http://www.rocketaware.com/perl/perlfunc/chop.htm says that it "chops
off the last character of a string and returns the character chopped".

Therefore, I am closing this as not a bug. If I have misunderstood the
problem, or you still believe this is incorrect behavior, please
reopen with additional information.


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