Paul wrote:
> I am assigned the output of a function to a variable.
> 
> my$variable = (function);
> print "$variable\n";
> 
> The output is:
> text
> 0
> 
> So I try this:
> 
> chop my$variable = (function);
> print "$variable\n";
> 
> The output is:
> text
> *** this is blank space output *****
> 
> So it get's rid of the "0", but outputs a new line.
> 
> I try double chopping with same results.
> 
> How can I finally get rid of it, I just want the text output.  Ugh.
> 

#!/usr/bin/perl

use warnings;
use strict;

my $variable = "text\n0";

print "first: $variable\n";

$variable =~ s/\s+//;
$variable =~ s/\d+//;

print "second: $variable\n";

--- output ---

pearl# ./rmtext.pl
first: text
0
second: text
pearl#



> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to