#!/usr/local/bin/perl -w use strict; use subs 'open'; no strict 'refs'; sub open (*;$@) { my $file=shift; my $args=shift; print "My_open\n"; # Do whatever you want CORE::open (*{$file}, $args); } open OUTPUT, ">test2.txt"; print OUTPUT "Hi there.\n"; close OUTPUT; __END__ $ perl override.pl My_open $ cat test2.txt Hi there.