summaryrefslogtreecommitdiff
path: root/flashcards.plx
diff options
context:
space:
mode:
Diffstat (limited to 'flashcards.plx')
-rwxr-xr-xflashcards.plx20
1 files changed, 15 insertions, 5 deletions
diff --git a/flashcards.plx b/flashcards.plx
index 7671812..bc6e8f2 100755
--- a/flashcards.plx
+++ b/flashcards.plx
@@ -78,10 +78,20 @@ while($line = <$fh>) {
close($fh);
# Go through each card (automatically shuffled!)
-foreach my $k (keys %cards) {
- print "$k\n";
+while(scalar %cards > 0) {
+ print scalar %cards . " cards remaining\n";
readline(STDIN);
- print "$cards{$k}\n";
- readline(STDIN);
- print "\n";
+ foreach my $k (keys %cards) {
+ print "$k\n";
+ readline(STDIN);
+ print "$cards{$k}\n";
+
+ # Check if card should be placed back in deck or discarded
+ print "Discard? [Y/n] ";
+ $line = readline(STDIN);
+ if(!($line =~ /[nN].*/)) {
+ delete $cards{$k};
+ }
+ print "\n";
+ }
}