F
fatted
Can someone explain this to me please?
use strict;
use warnings;
my @array = ( "one", "two", "three", "four", "fi_ve");
foreach my $value (@array)
{
$value =~ s/_/ /g;
print @array;
print "\n";
}
------
Results in:
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi ve
But:
------
use strict;
use warnings;
my @array = ( "one", "two", "three", "four", "fi_ve");
foreach (@array)
{
my $value = $_;
$value =~ s/_/ /g;
print @array;
print "\n";
}
-------
Gives:
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
(Note _ on last line of this result set compared to previous).
use strict;
use warnings;
my @array = ( "one", "two", "three", "four", "fi_ve");
foreach my $value (@array)
{
$value =~ s/_/ /g;
print @array;
print "\n";
}
------
Results in:
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi ve
But:
------
use strict;
use warnings;
my @array = ( "one", "two", "three", "four", "fi_ve");
foreach (@array)
{
my $value = $_;
$value =~ s/_/ /g;
print @array;
print "\n";
}
-------
Gives:
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
onetwothreefourfi_ve
(Note _ on last line of this result set compared to previous).