#!/usr/bin/perl

use strict;
use warnings;

use File::Basename;

my $fpath = "/home/user/hello/hey.pl";

print "Original  : " . $fpath . "\n";

my($filename, $directories) = fileparse($fpath);

print "Filename  : " . $filename    . "\n";
print "Directory : " . $directories . "\n";