If the code is also used at other places, then put in a sub:
use strict; print foo("abcCj"); sub foo { return ($_[0] =~ /TC/g) ? "TC" : "26 "; }
The points here are:
In reply to Re: Use variable outside if statement
by pg
in thread Use variable outside if statement
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |