#!/usr/bin/perl -wl use TrueFalse; BEGIN { *CORE::GLOBAL::index = sub { my $pos = (@_ == 3) ? CORE::index($_[0], $_[1], $_[2]) : CORE::index($_[0], $_[1]); boolean $pos => ($pos == -1 ? false : true); }; *CORE::GLOBAL::rindex = sub { my $pos = (@_ == 3) ? CORE::rindex($_[0], $_[1], $_[2]) : CORE::rindex($_[0], $_[1]); boolean $pos => ($pos == -1 ? false : true); }; *CORE::GLOBAL::system = sub { my $ret = system(@_); boolean $ret => ($ret ? false : true); } } print "j => $x" if $x = index "jeff", "j"; print "r => $x" if $x = rindex "jeff", "r"; system "ls" or warn "ls failed";