in reply to if else condition not assigning value when using my
See Coping with Scoping#!/usr/bin/perl -- use strict; use warnings; { my $one = 1; my $two = 1; { my $one = 3; ## new $one my $two = 4; ## new $two print "$one $two\n"; # old $one $two } if( time ){ my $one = 5; ## new $one my $two = 6; ## new $two print "$one $two\n"; # old $one $two } print "$one $two\n"; # old $one $two } ### NO $one/$two exist here ## print "$one $two\n"; __END__ 3 4 5 6 1 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: if else condition not assigning value when using my
by Anonymous Monk on Apr 08, 2010 at 23:19 UTC |