Another way would be to split based on '/' and get the last element of the array. This is one of the methods that holli suggested (using split). Depending on your OS, the path separator may change - in which case the split character needs to reflect that:
my $full_file = '/usr/local/prj/code/prog/prog1';
print "Filename is: " . (split '/', $full_file)[-1];
--------------------
mlh2003