#!/usr/bin/perl -T use strict; use warnings; # taken from Programming Perl, 3rd edition, p 561 sub is_tainted { my $arg = shift; my $nada = substr($arg, 0, 0); local $@; eval { eval "# $nada" }; return (length($@) != 0) ? 'tainted' : 'not tainted'; } my %hash = (); open FILE, $0 or die "cannot open $0: $!"; while (my $line = ) { chomp $line; warn is_tainted($line); $hash{$line} = is_tainted($line); } close FILE; foreach my $key (keys %hash) { warn is_tainted($key); }