Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

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


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

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...
  • Comment on Re^7: following if condition fails to print its variable using perl?
  • Download Code

Replies are listed 'Best First'.
Re^8: following if condition fails to print its variable using perl?
by huck (Parson) on Mar 16, 2017 at 04:59 UTC

    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);

Re^8: following if condition fails to print its variable using perl?
by poj (Abbot) on Mar 16, 2017 at 07:29 UTC

    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://1184813]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2020-09-29 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (147 votes). Check out past polls.

    Notices?