in reply to Use variable outside if statement
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:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Use variable outside if statement
by davido (Cardinal) on Dec 18, 2003 at 04:22 UTC | |
by skyknight (Hermit) on Dec 18, 2003 at 16:33 UTC |