in reply to Stable mixing of 2 arrays into a 3rd
You are checking that @t1 has not been emptied, but you are forgetting to check whether @t2 is empty. For example:
shift @{ ( !@t2 or ( rand() < .5) && @t1 ) ? \@t1 : \@t2 }
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Stable mixing of 2 arrays into a 3rd
by BrowserUk (Patriarch) on Oct 02, 2004 at 03:08 UTC |