Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: following if condition fails to print its variable using perl?

by poj (Abbot)
on Mar 15, 2017 at 12:15 UTC ( #1184688=note: print w/replies, xml ) Need Help??


in reply to Re^4: following if condition fails to print its variable using perl?
in thread following if condition fails to print its variable using perl?

Did you want to change that file here

change_file( $mapfile, $name_map, $regex ); poj
  • Comment on Re^5: following if condition fails to print its variable using perl?
  • Download Code

Replies are listed 'Best First'.
Re^6: following if condition fails to print its variable using perl?
by finddata (Sexton) on Mar 16, 2017 at 03:20 UTC
    yes
      if ( $name_map->{$base_name} ) { my $new_name = $name_map->{$base_name} . '.config' +; print 'newfile:'.$new_name."\n; # print $new_name; rename_file_or_dir( $name, $new_name ); change_file( $mapfile, $name_map, $regex ); }
      this if condition is not working...

        Did it post an error/warning or do you mean it isnt doing what you wanted it to do?

        if its not doing what you wanted it to do are the names as seen from print 'name   :'.$name,"\n"; what you expected them to be?

        Maybe adding this change would help you understand what is going on

        if (( my $base_name = $name) =~ s/\.config$// ) { print 'base_name:'.$base_name."\n"; if ( $name_map->{$base_name} ) {

        This could help you understand too

        my $name_map = read_map( $mapfile ); use Data::Dumper; print Dumper($name_map);

        Can you post the complete script please.


        poj

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1184688]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2020-10-30 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (277 votes). Check out past polls.

    Notices?