develooper Front page | perl.beginners | Postings from September 2008

substitute using directory name

Thread Previous | Thread Next
From:
brian54321uk
Date:
September 3, 2008 06:56
Subject:
substitute using directory name
Hi
I would like to replace a string of characters in a file to the name of 
the directory it is in.
Thefore, in the example below, I would like to know how to replace "?"


open( F, $ARGV[0] );

while( <F> ) {

  s!abc123!?!;

  s!xyz123!123xyz!;


{

   print;

  }

}


Any help much appreciated.
Brian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About