saintex has asked for the wisdom of the Perl Monks concerning the following question:
The code:# text 1 # text 2 # text 3 # text 4 # text 5 /home/wolf/Scrivania/foto-recco /home/wolf/Scrivania/rescue
use FindBin qw ($Bin); my $test='hello'; my $ref2Test=\$test; my $source="$Bin/directories.txt"; open DIRECTORIES, "<",$source; while(<DIRECTORIES>) { # chomp; print "this is \$_: $_\n"; print "An that is my string:\n"; print "initial $$ref2Test middle '$_' final "; print "\n----------------------\n\n"; } close DIRECTORIES;
this is $_: # text 1 An that is my string: initial hello middle '# text 1 ' final ---------------------- this is $_: # text 2 An that is my string: initial hello middle '# text 2 ' final ---------------------- this is $_: # text 3 An that is my string: initial hello middle '# text 3 ' final ---------------------- this is $_: # text 4 An that is my string: initial hello middle '# text 4 ' final ---------------------- this is $_: # text 5 An that is my string: initial hello middle '# text 5 ' final ---------------------- this is $_: /home/wolf/Scrivania/foto-recco An that is my string: initial hello middle '/home/wolf/Scrivania/foto-recco ' final ---------------------- this is $_: /home/wolf/Scrivania/rescue An that is my string: initial hello middle '/home/wolf/Scrivania/rescue' final ----------------------
<br /><br />this is $_: # text 1 An that is my string: ' final ello middle '# text 1 ---------------------- this is $_: # text 2 An that is my string: ' final ello middle '# text 2 ---------------------- this is $_: # text 3 An that is my string: ' final ello middle '# text 3 ---------------------- this is $_: # text 4 An that is my string: ' final ello middle '# text 4 ---------------------- this is $_: # text 5 An that is my string: ' final ello middle '# text 5 ---------------------- this is $_: /home/wolf/Scrivania/foto-recco An that is my string: ' final ello middle '/home/wolf/Scrivania/foto-recco ---------------------- this is $_: /home/wolf/Scrivania/rescue An that is my string: initial hello middle '/home/wolf/Scrivania/rescue' final ----------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange read file behaviour
by almut (Canon) on Jun 28, 2010 at 11:26 UTC | |
by saintex (Scribe) on Jun 28, 2010 at 12:10 UTC | |
by ikegami (Patriarch) on Jun 28, 2010 at 15:37 UTC | |
|
Re: Strange read file behaviour
by jethro (Monsignor) on Jun 28, 2010 at 11:26 UTC | |
|
Re: Strange read file behaviour
by jwkrahn (Abbot) on Jun 28, 2010 at 11:24 UTC | |
by almut (Canon) on Jun 28, 2010 at 12:20 UTC | |
|
Re: Strange read file behaviour
by Marshall (Canon) on Jun 28, 2010 at 11:41 UTC | |
|
Re: Strange read file behaviour
by Anonymous Monk on Jun 28, 2010 at 10:53 UTC |