G
George
Dear All,
I wrote a function to mimic the behavior of the trim function in
Javascript as follows:
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
Then I am using it as follows:
$finalstate = chomp(trim(<STDIN>));
When I try and run it, I get the following message:
Can't modify non-lvalue subroutine call in chomp at ./trans2autnew.pl
line 63, near "))"
Execution of ./trans2autnew.pl aborted due to compilation errors.
(of course, strict and warnings are on).
Could you help me resolving this as I new to Perl (but not in
programming in general)?
Regards,
George
I wrote a function to mimic the behavior of the trim function in
Javascript as follows:
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
Then I am using it as follows:
$finalstate = chomp(trim(<STDIN>));
When I try and run it, I get the following message:
Can't modify non-lvalue subroutine call in chomp at ./trans2autnew.pl
line 63, near "))"
Execution of ./trans2autnew.pl aborted due to compilation errors.
(of course, strict and warnings are on).
Could you help me resolving this as I new to Perl (but not in
programming in general)?
Regards,
George