hi guys,
i have an array called ARRAY which has elements in it... i am trying to assign elements of ARRAY to master_array..
i get a =: command not found error..
i=0
while
do
${master_array}=${ARRAY}
((i++))
done
is there something i am missing? (4 Replies)
Hi!
Could someone explain me why the below code is printing the contents of IF block 5 times instead of 0?
#!/bin/bash
VAR1="something"
VAR2="something"
for((i=0;i<10;i++))
do
if(($VAR1=~$VAR2))
then
echo VAR1: $VAR1
echo... (3 Replies)
Hey guys,
I'm kinda a noob at scripting. I am trying to create a script that uses multiple for loops with the lsiutility to monitor disk health on a system.
The script runs, but it will continually echo an infinite number of LogVolumes when there are only 2 per virtual disk on my server. It's... (2 Replies)
Hello All,
i have a really strange copy paste problem. When I write some loops in an editor for example:
for j in 1 2 3
do
echo "$j"
done
and I want to paste it to the shell, the result in the shell is:
for j in 1 2 3; do e;
other commands work fine and if a copy paste... (4 Replies)
Hi All,
I've been researching this problem and I am pretty sure that the issue is related to the while loop and the piping. There are plenty of other threads about this issue that recommend removing the pipe and using redirection. However, I haven't been able to get it working using the ssh and... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Your shell script should continue to execute until the user selects option 4
2. Relevant commands, code,... (2 Replies)
Hi,
This is probably going to be very simple but i came across something i can't quite explain. Here is the situation: i have a list of files, which i'd like to process one by one (get the size, make some tests, whatever) and generate some statistics using different variables.
Something... (5 Replies)
hello
i'm writing a script and I want to use a for loop inside a while loop as following:
while read line;
do
echo $line
for i in $vrm;
do
echo $i
done
done < './contacts'
when i use just the while loop it prints the lines from file ./contacts just... (13 Replies)
What is the proper way to run two bash loops in the same command? The two below loops run separately, the problem is when I pipe them I get an error that the file used for the second loop does not exist. I am not sure how to wait for the first loop to complete and then start the second. Thank... (10 Replies)
Hello,
Below I try to control that the input is good an IP :
#!/bin/bash
cp /home/scripts/choice_interfaces.txt /home/scripts/interfaces.txt
chmod 644 /home/scripts/interfaces.txt
echo -e "Please enter the network informations into the /etc/network/interfaces file, complete them below... (9 Replies)
Discussion started by: Arnaudh78
9 Replies
LEARN ABOUT DEBIAN
statistics::basic::correlation
Statistics::Basic::Correlation(3pm) User Contributed Perl Documentation Statistics::Basic::Correlation(3pm)NAME
Statistics::Basic::Correlation - find the correlation between two lists
SYNOPSIS
Invoke it this way:
my $correlation = correlation( [1,2,3], [1,2,3] );
Or this way:
my $v1 = vector(1,2,3);
my $v2 = vector(1,2,3);
my $cor = corr($v1,$v2);
And then either query the values or print them like so:
print "The correlation between $v1 and $v2: $correlation
";
my $cq = $cor->query;
my $c0 = 0+$correlation;
Create a 20 point "moving" correlation like so:
use Statistics::Basic qw(:all nofill);
my $sth = $dbh->prepare("select col1,col2 from data where something");
my $len = 20;
my $cor = corr()->set_size($len);
$sth->execute or die $dbh->errstr;
$sth->bind_columns( my ($lhs, $rhs) ) or die $dbh->errstr;
my $count = $len;
while( $sth->fetch ) {
$cor->insert( $lhs, $rhs );
if( defined( my $c = $cor->query ) ) {
print "Correlation: $c
";
}
# This would also work:
# print "Correlation: $cor
" if $cor->query_filled;
}
METHODS
This list of methods skips the methods inherited from Statistics::Basic::_TwoVectorBase (things like query(), insert(), and ginsert()).
new()
Create a new Statistics::Basic::Correlation object. This function takes two arguments -- which can either be arrayrefs or
Statistics::Basic::Vector objects. This function is called when the correlation() shortcut-function is called.
query_covariance()
Returns the Statistics::Basic::Covariance object used to calculate the correlation.
query_vector1()
Return the Statistics::Basic::Vector for the first vector.
query_vector2()
Return the Statistics::Basic::Vector object for the second vector.
query_mean1()
Returns the Statistics::Basic::Mean object for the first vector.
query_mean2()
Returns the Statistics::Basic::Mean object for the second vector.
OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation or the value of the computation in numeric
context.
In boolean context, this object is always true (even when empty).
AUTHOR
Paul Miller "<jettero@cpan.org>"
COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL
SEE ALSO perl(1), Statistics::Basic, Statistics::Basic::_TwoVectorBase, Statistics::Basic::Vector
perl v5.14.2 2012-01-23 Statistics::Basic::Correlation(3pm)