ashaman has asked for the wisdom of the Perl Monks concerning the following question:
use strict; open(PLAYLIST, "<playlist.m3u"); opendir(FILES, 'd:\my files'); my @playlist = (); my @filelist = grep {/\.mp3$/} readdir FILES; my $song; while(<PLAYLIST>) { if(not(/#/)) {push(@playlist, $_)} } foreach $song(@filelist) { if(grep($song, @playlist) == 0) { unlink($song) } } closedir FILES; close PLAYLIST;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing two lists
by particle (Vicar) on Jun 24, 2001 at 03:49 UTC | |
|
Re: comparing two lists
by thraxil (Prior) on Jun 24, 2001 at 04:36 UTC | |
by ashaman (Sexton) on Jun 24, 2001 at 08:28 UTC | |
by chipmunk (Parson) on Jun 24, 2001 at 18:16 UTC | |
|
Re: comparing two lists
by Beatnik (Parson) on Jun 24, 2001 at 12:25 UTC | |
|
Re: comparing two lists
by scottstef (Curate) on Jun 24, 2001 at 19:21 UTC |