recentpopularlog in

therobyouknow : syntax   19

Bash script, read file into array (Newbie)
while read line ; do
MYARRAY[$index]="$line"
index=$(($index+1))
done < $ips
array  file  howto  linux  load  read  reference  script  syntax  tip  bash  shell  bsh  loop  computing  work 
july 2010 by therobyouknow
How do I return multiple variables from a subroutine?
main
{
my ( $hashRef1, $hashRef2 ) = function1();

function2( $hashRef1, $hashRef2 );
}

sub function1
{
my %hash1 = ();
my %hash2 = ();
# ... some code ...
return( \%hash1, \%hash2 );
}

sub function2
{
my ( $paramHashRef1, $paramHashRef2 ) = @_;

# ... deref by %$paramHashRef1 and %$paramHashRef2 etc
}

main();
perl  hash  return  argument  parameter  between  returning  function  multiple  subroutine  programming  language  computing  syntax  method  howto  advice  work  reference  dereference  passby 
march 2010 by therobyouknow

Copy this bookmark:





to read