Perl subroutine needs reference?

20 pts.
Tags:
Perl
(Sorry about dropping line feeds. "How to use editor" does not open. Is there a manual html-type insertion I can use, like ?) With string: my $kp = "(@array[$i1]*@array2[$i2])*(@array3[$i3]*@array[$i4])"; @array elements are those strings to find: ee, sd .. etc, in the sub tt3' regex substitutions below. I want to tt3($kp), as other similar tt3($kp1), tt3($kp2), ..., in the currently faulty below subroutine. It now produces: # ERROR: Too many arguments for main::ttt3 at ./c.pl line 253, near "$kp)" sub ttt3 { my($input) = @_; # tried: # $input = eval($input); # $kin = eval($kin); my($kin) = $input; $kin =~ s/ee/e2/g; $kin =~ s/zd/zn/g; $kin =~ s/zt/zm/g; $kin =~ s/zq/zr/g; $kin =~ s/zc/zL/g; $kin =~ s/sd/s2/g; $kin =~ s/st/sm/g; $kin =~ s/sc/sL/g; return($kin); } sub tt3 needs reference? how? where?  

Software/Hardware used:
perl Suse asus901

Answer Wiki

Thanks. We'll let you know when a new response is added.

With string:

 
my $kp = "(@array[$i1]*@array2[$i2])*(@array3[$i3]*@array[$i4])";

@array elements are those strings to find: ee, sd .. etc, in the sub tt3' regex substitutions below.

I want to tt3($kp), as other similar tt3($kp1), tt3($kp2), ..., in the currently faulty below subroutine.

It now produces:

# ERROR: Too many arguments for main::ttt3 at ./c.pl line 253, near "$kp)"

sub ttt3 {

my($input) = @_;

# tried:
# $input = eval($input);
# $kin = eval($kin);

my($kin) = $input;
$kin =~ s/ee/e2/g;
$kin =~ s/zd/zn/g;
$kin =~ s/zt/zm/g;
$kin =~ s/zq/zr/g;
$kin =~ s/zc/zL/g;
$kin =~ s/sd/s2/g;
$kin =~ s/st/sm/g;
$kin =~ s/sc/sL/g;

return($kin);
}

sub tt3 needs reference? how? where?

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: