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 ----------------------
In reply to Strange read file behaviour by saintex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |