Hi Guys,
Im trying to build a small test function.
Im (trying to) passing a variable to the function, then have that function check the string to see if it matches anything. Once the check has finished, i want it to pass a variable back.
Heres my code:
sub Check{
my ($CheckDetail) = @_;
switch ($CheckDetail){
case "ThisisCorrect" {
$Useit = "Yes"}
case "ThisisWrong" {
$Useit = "No"}
}
}
I have saved this as a module and are 'using' it in another program.
I am calling this aboe function by using this code:
my $doweUse = Check($Checktype)
However i am getting these errors:
String found where operator expected at /perl/site/lib//findlinks.pm line 68, near "case "case1""
(Do you need to predeclare case?)
String found where operator expected at /perl/site/lib//findlinks.pm line 70, near "case "case2""
(Do you need to predeclare case?)
syntax error at /perl/site/lib//findlinks.pm line 67, near "){"
syntax error at /perl/site/lib//findlinks.pm line 70, near "case "case2""
Compilation failed in require at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\script2.pl line 8.
I'm struggling to find what it means and what i have done wrong.
All help would be appreciated!!
Thank you in advance!
Nash
Im trying to build a small test function.
Im (trying to) passing a variable to the function, then have that function check the string to see if it matches anything. Once the check has finished, i want it to pass a variable back.
Heres my code:
sub Check{
my ($CheckDetail) = @_;
switch ($CheckDetail){
case "ThisisCorrect" {
$Useit = "Yes"}
case "ThisisWrong" {
$Useit = "No"}
}
}
I have saved this as a module and are 'using' it in another program.
I am calling this aboe function by using this code:
my $doweUse = Check($Checktype)
However i am getting these errors:
String found where operator expected at /perl/site/lib//findlinks.pm line 68, near "case "case1""
(Do you need to predeclare case?)
String found where operator expected at /perl/site/lib//findlinks.pm line 70, near "case "case2""
(Do you need to predeclare case?)
syntax error at /perl/site/lib//findlinks.pm line 67, near "){"
syntax error at /perl/site/lib//findlinks.pm line 70, near "case "case2""
Compilation failed in require at C:\Documents and Settings\Lee Nash\Desktop\GAF Projects\Betting\Perl\script2.pl line 8.
I'm struggling to find what it means and what i have done wrong.
All help would be appreciated!!
Thank you in advance!
Nash