Read command line arguments

The simplest way to read command line arguments is via the special variable @ARGV.

use strict;
use warnings;

require 'anagrams.pm';

use feature 'say';


if (@ARGV != 1) {
    say 'Usage: get_anagrams.pl <word>';
    exit 1;
}

foreach my $word (get_permutations($ARGV[0])) {
    say $word;
}

Read more