T
TheOrangeRemix
I'm writing a Perl script to take in an array and a scalar as two
arguments and pass them to a subroutine.
Each element of the array has contents ########### word ########### and
the scalar being passed is the size of the array.
The subroutine is supposed to strip the '#" from the contents of each
element and just report the "word" in one array, and report the size of
the array in a scalar.
Here is the code:
-------------------------------------------------------------------------------
unhash(@Array_A,$a); # array and size
sub round {
my($number) = shift;
return int($number + .5);
}
sub unhash
{
my(@fieldarray) = @_;
my($sizearray) = shift;
print "$sizearray\n";
for ($i = 0; $i < $sizearray; $i++)
{
if ($fieldarray[$i] =~ m/########### (.*?)#/)
{
$fieldarray[$i] = $1;
}
}
print @fieldarray;
}
arguments and pass them to a subroutine.
Each element of the array has contents ########### word ########### and
the scalar being passed is the size of the array.
The subroutine is supposed to strip the '#" from the contents of each
element and just report the "word" in one array, and report the size of
the array in a scalar.
Here is the code:
-------------------------------------------------------------------------------
unhash(@Array_A,$a); # array and size
sub round {
my($number) = shift;
return int($number + .5);
}
sub unhash
{
my(@fieldarray) = @_;
my($sizearray) = shift;
print "$sizearray\n";
for ($i = 0; $i < $sizearray; $i++)
{
if ($fieldarray[$i] =~ m/########### (.*?)#/)
{
$fieldarray[$i] = $1;
}
}
print @fieldarray;
}