#!/usr/bin/env perl use warnings; use strict; chomp (my $user = `whoami`); chomp (my $host = `hostname`); my $file = $ARGV[0] || $ENV{PWD}; # does file start with '/' indicating full path? if ($file !~ m|^/|) { $file = $ENV{PWD}."/$file"; } print "/[$user\@$host]$file\n";