#!/usr/bin/perl $sciezka="/var/spool/voice/incoming/"; open (skad, "ls /var/spool/voice/incoming -l -c -r|"); @pliki = ; if (@pliki==1){die("You don't have any new messages\n");} for($x=1; $x<@pliki; $x++){ $wyb=""; $_ = $pliki[$x]; ($a, $b, $c, $d, $e, $f, $g, $h, $nazwa) = split(/\s+/); print("Message nr $x saved $g $f on $h\n"); `vm play -s $sciezka$nazwa`; while($wyb !~ /[y,Y,n,N]/){ print("Do you want to delete this message (y/n) or play it again (a)?"); $wyb=; if($wyb =~ /[y,Y]/){`rm $sciezka$nazwa`;} elsif($wyb =~ /[a,A]/){`vm play -s $sciezka$nazwa`;} elsif($wyb =~ /[n,N]/){} else{print("Wrong choice. Try again.\n");}}}