#!/usr/local/bin/perl

#Simple Script to take the string of an absolute path and 
#only return the filename (i.e. the letters after the last /

#Sample Path
my $pretend_file="/home/Lance/perl/double/four.m4a";

#Makes an array where each element is / 
my @matches=($pretend_file=~m/\//g);

#This is the butter: returns the stuff after the last / (or the last successful pattern match) I'll use this
my $last=$';

#These are supposed to be The last bracket matched by the last search pattern and The string preceeding whatever was matched by the last successful pattern, respectively.
my $first=$+;
my $unknown=$\;

#The split function works, but doesn't give stuff after last match like m//.
my @filename=split(/\//,$pretend_file);

#Will print all of the directories
foreach(@filename){
	print "$_\n";

	}
#Will print however many / there are
foreach(@matches){
	print "$_\n";
	}

#Prints the gravy: the relative filename
print "$last\n";

