Bug 124259 - Perl chop gives only new lines in output
Perl chop gives only new lines in output
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Chip Turner
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-25 04:56 EDT by Tomi Malkki
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-25 14:31:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomi Malkki 2004-05-25 04:56:06 EDT
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 14:31:10 EDT
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.