The hash was not suggested because of efficiency.
I suggested a hash because they require less coding and make your life
so much easier.
Less coding, less room for errors, nicer code, etc.
Not to mention that filling a hash from a textfile is trivial, so you
can move the associations into a file.
Johnson, Reginald (GTI) wrote:
I don't see what I'm doing wrong here. I just want to compare the value
of $_ and return the indicated string if there is a match.
#!/usr/bin/perl
use strict;
use warnings;
my $temp_proc;
my $mnt_proc = "AVI";
$temp_proc = convert_mnt_proc($mnt_proc);
#
EMAIL PROTECTED] On Behalf Of yitzle
Sent: Wednesday, April 18, 2007 10:24 AM
To: Johnson, Reginald (GTI)
Cc: beginners@perl.org
Subject: Re: Return value from subroutine
> return = "Audit Volume";
You have
return = "thingy";
You want
return &q
On 4/18/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote:
if ($_ eq /AVI/) {
return = "Audit Volume";
}
Perl's return operator isn't a variable you assign to. Maybe you want this?
return "Audit Volume"; #
2007/4/18, Johnson, Reginald (GTI) <[EMAIL PROTECTED]>:
if ($_ eq /AVI/) {
Above is not right.
Maybe '$_ =~ /AVI/' or ' $_ eq "AVI" '?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
return = "Audit Volume";
You have
return = "thingy";
You want
return "thingy";
if ($_ eq /AVI/) {
return = "Audit Volume";
}
elsif (/BKP/) {