finddata has asked for the wisdom of the Perl Monks concerning the following question:
inputfile: base { LOCATION:../set/projects/all/files }
In the above code the location line has directory location.These directory location starts with .. How can i remove the .. from the directory line and read only the location of the directoryMy code: my $fn="inputfile"; open ( my $fh, '<', $fn ) or die "Could not open file '$fn': $!"; while ( <$fh> ) { chomp; if (/^LOCATION:\s*(\S+)/) { $input_dir = $1; print $input_dir; } My output is as follows: ../set/projects/all/files expected one: /set/projects/all/files
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read the directories from file (updated)
by haukex (Archbishop) on Mar 27, 2017 at 07:49 UTC | |
|
Re: Read the directories from file
by Discipulus (Canon) on Mar 27, 2017 at 07:45 UTC | |
|
Re: Read the directories from file
by Anonymous Monk on Mar 27, 2017 at 07:34 UTC | |
|
Re: Read the directories from file
by madtoperl (Hermit) on Mar 27, 2017 at 09:48 UTC |