in reply to Re: how to "rename" a global argument in subroutine?
in thread how to "rename" a global argument in subroutine?
And if those RGB variables are "static", then why not put them into a nice hash?
#!/usr/bin/perl use strict; use warnings; my %COLORS = ( red => undef, green => undef, blue => undef, ); sub change{ my($R,$G,$B) = @_; $COLORS{red} = $R; $COLORS{green} = $G; $COLORS{blue} = $B; } change(11); print $COLORS{red};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to "rename" a global argument in subroutine?
by Anonymous Monk on Aug 11, 2015 at 18:48 UTC |