The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 02-07-2008
deepakwins deepakwins is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 39
Thakns this worked!!!

Is there any simple method to do to parent directory.
similar to "cd .."??
Quote:
Originally Posted by MobileUser View Post
Hi,
It should work fine. I tried the following...


Code:
#!/usr/bin/perl -w
use strict;

# Program to accept a file path and store it in a array

my $dir = "/abc/def/ghi/";

my @Dir = split(/\//, $dir);

pop(@Dir);

my $PreviousDir = join("/", @Dir);
print "The original Directory is $dir\n";
print "The new Directory is $PreviousDir\n";