Advertisement

08.10.2007 at 08:15AM PDT, ID: 22754799
[x]
Attachment Details

Remove carriage return characters when using Perl module: Spreadsheet::WriteExcel

Asked by rkckjk in Perl Programming Language

Tags: perl, return, carriage, remove

I'm using the following Perl script to create a spreadsheet from a text file. Basically the script works, but it's inserting a little square(carriage return character) as part of the $ACTIVITY field.


#!/opt/perl/bin/perl

use strict;
use Spreadsheet::WriteExcel;

my $InputFile = "/nmltest/dailyops/data/Log.txt";
my $OutputFile = "//ho/dfs01/work/IS/Operations/GROUP0K/Automation/DailyActivities/Activities/Daily Activities test.xls";

open (INPUT, "$InputFile") or die "$InputFile $!";

my $workbook = Spreadsheet::WriteExcel->new($OutputFile);
my $worksheet = $workbook->add_worksheet();
$worksheet->write('A1', "LAN ID");
$worksheet->write('B1', "Activity");

my $row = 1;

while (<INPUT>)
      {
chomp($_);
my ($LANID, $ACTIVITY) = split(/\|/, $_);
$worksheet->write($row, 0, $LANID);
$worksheet->write($row, 1, $ACTIVITY);
$row++;
    }
close INPUT;

thanks
Start Free Trial
[+][-]08.10.2007 at 08:25AM PDT, ID: 19670680

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl, return, carriage, remove
Sign Up Now!
Solution Provided By: jasonsbytes
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.10.2007 at 08:32AM PDT, ID: 19670764

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.10.2007 at 11:08AM PDT, ID: 19672200

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628