For Example:
Now if I syntax check this or run it I would get the following error.#!/usr/bin/perl -w use strict; die "Required argument missing!\n" unless ($ARGV[0]); if ($ARGV[0] =~ /Hello/i) { my $response = "Hello to you.\n"; }else{ my $response = "Huh?\n"; } print $response;
Global symbol "$response" requires explicit package name at syn_check line 11. syn_check had compilation errors.What is the best way to pass the variable $response out of the if statement to make it visible at another level? Remember I do not want to make the variable global either.
In reply to Best way to pass variables? by Elijah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |