in reply to Read the directories from file
How can i remove the .. from the directory line and read only the location of the directory
Do it after?
A more generic parser
my %action = ( LOCATION => sub { my( $dir ) = @_; $dir =~ s{^\.\.}{}; print $dir; }, ); ... while ... /^ # start of line \s* # optional padding ( [^:]+ ): # $1 key, not ':' \s* ([^\r\n]*) # $2 value, not line end [\r\n]* # end of line /xm and do { my( $key, $value ) = @_; my $action = $parser{ $key } || $parser{default}; $action->($value); };
|
|---|