#!/usr/bin/env perl use v5.36; # was 'use 5.010;' #use warnings; # unnecessary now! use strict; no if $] >= 5.018, warnings => "experimental::smartmatch"; use Getopt::Std; my %opts; getopts( 'hvi:', \%opts ) or die "getopts failed\n"; my $verbose; my $infile; while ( my ( $k, $v ) = each %opts ) { given ($k) { # <-- line 13 when ('h') { ...; } when ('v') { ++$verbose; } when ('i') { $infile = $v; } default { die "*** BUG: no handler for -$k.\n"; } } } #### syntax error at /Users/chap/private/perl/t0 line 13, near ") {" syntax error at /Users/chap/private/perl/t0 line 15, near ") {" Global symbol "$v" requires explicit package name (did you forget to declare "my $v"?) at /Users/chap/private/perl/t0 line 16. Execution of /Users/chap/private/perl/t0 aborted due to compilation errors.