Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by finddata (Sexton)
on Mar 16, 2017 at 03:20 UTC ( #1184812=note: print w/replies, xml ) Need Help??


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

yes
  • Comment on Re^6: following if condition fails to print its variable using perl?

Replies are listed 'Best First'.
Re^7: following if condition fails to print its variable using perl?
by finddata (Sexton) on Mar 16, 2017 at 03:22 UTC
    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://1184812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2020-08-07 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (50 votes). Check out past polls.

    Notices?