Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing all output in one line

Status
Not open for further replies.
Jun 3, 2007
84
US
Hello I have the code below which works for the most part, the only problem that I am trying to figure out is how to get rid of the CR (return) after the use of the $data[1] variable which is splitting my output from 1 line to 2 lines.

Code:
#!/usr/bin/perl
use strict;
use warnings;

open( FILE, $ARGV[0] ) || die "Cannot open file!";

while (<FILE>) {
    my $entries = $_;
    my @data = split(',', $entries);
    print "000269 xrd $data[0], strchr $data[1], trdchr 0029\n";
}

---------------------------------------------------------------------------------------
output 
000269 xrd 000101, strchr 001101
, trdchr 0029
000269 xrd 001122, strchr 0111001
, trdchr 0029

__________________________________________________
output should look like this
000269 xrd 000101, strchr 001101, trdchr 0029
000269 xrd 001122, strchr 0111001, trdchr 0029

Thanks for the help in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top