Fogle Cpl Shawn B wrote: > > I created a simple little program to play my flac files (see > http://flac.sf.net) randomly, this is my first program of any time to take > it easy on me (and I know I'm not too stylish, and I love one liners). The > problem is that when I play the files, I want it to go through the whole > array @music_list before it plays the same song over again. I have studied > the fisher_yates_shuffle but I can't seem to implement it to save my life.
perldoc -q shuffle Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod How do I shuffle an array randomly? [snip] If not, you can use a Fisher-Yates shuffle. sub fisher_yates_shuffle { my $deck = shift; # $deck is a reference to an array my $i = @$deck; while ($i--) { my $j = int rand ($i+1); @$deck[$i,$j] = @$deck[$j,$i]; } } > It would help quite a bit if I understood what "@$" is and how to > effectively use it. If you mean in reference to @$deck then $deck contains a reference to an array and @$deck allows you to access the elements of that array. perldoc perlref > I don't see it in the beginners manual (and haven't > searched the perldocs yet). Please feel free to diff me any improvements you > have, I'd love to see what improvements can be made (be it known I am > working on the short getopts). > > ------_=_NextPart_000_01C26DD1.32DAD5B0 > Content-Type: application/octet-stream; > name="flacme" > Content-Transfer-Encoding: quoted-printable > Content-Disposition: attachment; > filename="flacme" If you want help with code then please copy the code in your message. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]