#!/usr/bin/env perl -l use strict; use warnings; # Compile time use if $ENV{PM_1155832_USE}, 'List::Util' => qw{max}; BEGIN { print 'Check for List::Util::max() at compile time'; eval { max(1, 2) }; print $@ if $@; } # Runtime if (! $ENV{PM_1155832_USE}) { require List::Util; List::Util->import(qw{max}); } print 'Max is ', max(1, 2);