in reply to Taking Keyboard Input from the command line
Cheers - L~R#!/usr/bin/perl use strict; use warnings; my @array = qw(foo bar blah asdf); if ( defined $ARGV[0] && defined $ARGV[1] ) { push @array , $ARGV[1] if $ARGV[0] eq 'add'; @array = grep {$_ !~ /^$ARGV[1]$/} @array if $ARGV[0] eq 'del'; } print "$_\n" for @array;
Update: Corrected syntax error
|
|---|