Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

following if condition fails to print its variable using perl?

by finddata (Sexton)
on Mar 15, 2017 at 04:09 UTC ( #1184632=perlquestion: print w/replies, xml ) Need Help??

finddata has asked for the wisdom of the Perl Monks concerning the following question:

Here am trying to match the files using perl?
if ( ( -d $name ) && ( exists $name_map->{$name} ) ) { #print $name; my $new_name = $name_map->{$name}; # print $new_name; rename_file_or_dir( $name, $new_name ); $name = $new_name; #print $name; } elsif ( -f $name ) { if (( my $base_name = $name) =~ s/\.config$// ) { if ( $name_map->{$base_name} ) { my $new_name = $name_map->{$base_name} . '.config' +; # print $new_name; rename_file_or_dir( $name, $new_name ); change_file( $mapfile, $name_map, $regex ); }
the above print $new_name fails to print the statement .

Replies are listed 'Best First'.
Re: following if condition fails to print its variable using perl?
by hippo (Chancellor) on Mar 15, 2017 at 09:16 UTC

    You've posed a substantial number of very related questions recently. If you'd like some help to solve a particular problem which you have encountered with Perl then you will receive a great deal more help if you read, understand and put into practice the suggestions of SSCCE.

    The choice is entirely yours of course. However, if you continue in the same vein as currently you may find that both the patience and the interest of other monks will wain.

Re: following if condition fails to print its variable using perl?
by stevieb (Canon) on Mar 15, 2017 at 04:32 UTC

    Please show us what your input is, as well as what your expected output is.

    Being thrown a block of code without any context makes it a bit difficult to understand what you need.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2020-01-25 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?