(This should probably be an easy one for someone.}
Why doesn't this work:
[EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e @s=([a,b],[c,d]);print
$s[0][0];
syntax error at -e line 1, near ][
Execution of -e aborted due to compilation errors.
[EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e @s=([1,2
On Fri, Oct 31, 2008 at 01:34:05PM -0400, Zembower, Kevin wrote:
(This should probably be an easy one for someone.}
Why doesn't this work:
[EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e @s=([a,b],[c,d]);print
$s[0][0];
syntax error at -e line 1, near ][
Execution of -e aborted due
Oh, it was that simple. Thanks so much, Paul. -Kevin
-Original Message-
From: Paul Johnson [mailto:[EMAIL PROTECTED]
Sent: Friday, October 31, 2008 1:42 PM
To: Zembower, Kevin
Cc: 'beginners@perl.org'
Subject: Re: Why doesn't this work: perl -e @s=([1,2],[3,4]); print $s[0][0];
On Fri
Zembower, Kevin wrote:
(This should probably be an easy one for someone.}
Why doesn't this work:
[EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e @s=([a,b],[c,d]);print
$s[0][0];
syntax error at -e line 1, near ][
Execution of -e aborted due to compilation errors.
The shell interpolates your
I have a data file that looks like this:
uSF1 MD1500 0092149355224510209 0101001
88722397N0720900
116759 0Block Group 1
S 1158 662+39283007-076574503
uSF1 MD1500 0092150355224510209 0101002
88722397N0720900
109338
On Feb 26, 1:19 pm, [EMAIL PROTECTED] (Kevin Zembower) wrote:
I have a data file that looks like this:
uSF1 MD1500 009214935522451020 9 0101001
88722397N0720900
116759 0Block Group 1
S 1158 662+39283007-076574503
uSF1 MD1500
: Why doesn't this work: matching capturing
On Feb 26, 1:19 pm, [EMAIL PROTECTED] (Kevin Zembower) wrote:
I have a data file that looks like this:
uSF1 MD1500 009214935522451020 9 0101001
88722397N0720900
116759 0Block Group 1
S 1158 662+39283007
On Jan 11, 1:16 pm, [EMAIL PROTECTED] (Kevin Zembower) wrote:
$type eq unknown ? $type=human : $type=both;
You're trying to use the trinary like you would an if-then-else. You
want to instead use it in an assignment:
$type = ($type eq 'unknown') ? 'human' : 'both';
--
The best way to get a
When I execute this line:
$type eq unknown ? $type=human : $type=both;
$type is always both. But executing this line:
if ($type eq unknown) {$type=human} else {$type=both};
$type is human, which is want I want and expect. The context for these
statements in my program is pasted in at the
On Friday 11 January 2008 16:16:27 Zembower, Kevin wrote:
When I execute this line:
$type eq unknown ? $type=human : $type=both;
$type is always both. But executing this line:
if ($type eq unknown) {$type=human} else {$type=both};
$type is human, which is want I want and expect. The
Zembower, Kevin wrote:
When I execute this line:
$type eq unknown ? $type=human : $type=both;
$type is always both.
PRECEDENCE! ?: has higher precedence than =
You want to do it like this:
$type = $type eq 'unknown' ? 'human' : 'both';
John
--
Perl isn't a toolbox, but a small machine
John W. Krahn wrote:
Zembower, Kevin wrote:
When I execute this line:
$type eq unknown ? $type=human : $type=both;
$type is always both.
PRECEDENCE! ?: has higher precedence than =
You want to do it like this:
$type = $type eq 'unknown' ? 'human' : 'both';
Your code parses as:
(
hope I have done the same.
Thanks a lot!
You're welcome. Good luck.
-ZO
-Original Message-
From: Zeus Odin [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 12:09 AM
To: Li, Aiguo (NIH/NCI)
Subject: Re: Why doesn't this work?
Aiguo Li [EMAIL PROTECTED] wrote
Aiguo Li [EMAIL PROTECTED] wrote in message...
Hello,
Hello.
I have the following dataset and want to calculate a P/A ratio for each
replicates in the dataset. In this case, treatment 1 has 4 replicats and
treatment2 has 3 replicates. The P/A = [((#of P)*2) + (# of M)]/# of
replicates. The
the # of replicates in each treatment.
Thanks,
Aiguo
-Original Message-
From: Zeus Odin [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 11, 2004 8:08 AM
To: [EMAIL PROTECTED]
Subject: Re: Why doesn't this work?
Aiguo Li [EMAIL PROTECTED] wrote in message...
Hello,
Hello.
I have
Aiguo Li [EMAIL PROTECTED] wrote in message ...
Probe id Treat1 Treat2
AffX-BioB-5_at (2p +M)/4 =2 (2*3+0)/3=2
FFX-BioB-M_at (2*3+0)/4 =1.7 (2*3+0)/3=2
AFFX-BioB-3_at (2*2+0)/4 =1 (2*2+0)/3=1.3
AFFX-BioC-5_at (2*2+1)/4 =1.25 (2*1+1)/3=1
AFFX-BioC-3_at (2*1+1)/4 = 0.75 (2*2+1)/3=1.7
The
The following subroutine should take an input path (Dir0), process that
directory by recursively calling itself on subdirectories or processing
any files it contains. The problem I am experiencing is that in the
following example file structure it process Dir1 correctly, but after it
returns
Hello,
I have the following dataset and want to calculate a P/A ratio for each
replicates in the dataset. In this case, treatment 1 has 4 replicats and
treatment2 has 3 replicates. The P/A = [((#of P)*2) + (# of M)]/# of
replicates. The output should be two columns of P/A ratios for two
The following subroutine should take an input path (Dir0),
process that directory by recursively calling itself on
subdirectories or processing any files it contains. The
problem I am experiencing is that in the following example
file structure it process Dir1 correctly, but after it
If you are running this on *NIX box, plain old 'find' command is enough
too.
~A
On Tue, 9 Nov 2004, Jim wrote:
The following subroutine should take an input path (Dir0),
process that directory by recursively calling itself on
subdirectories or processing any files it contains. The
Is it possible for a server to see the difference between a browser and
a
script using the LWP::UserAgent module ? Can I fix this ?
Hi Rene,
I have come across this kind of problem before.
Usually it is the useragent string (try pretending to be IE!) or because
your not sending any cookies.
: Monday, January 27, 2003 2:37 AM
Subject: Why doesn't this work anymore ?
Hi all,
Don't know if this is off-topic :
I have a script that uses the LWP::UserAgent module to retrieve some page
content from an other website. This worked fine, untill a few days
ago. Now all I get is a 403
--- Octavian Rasnita [EMAIL PROTECTED] wrote:
Hi all,
I tried the following line to open another location, but it doesn't work.
print $screen - redirect(-uri='http://localhost/index.html');
It doesn't redirect to another location. It just prints the following:
Status: 302 Moved
Hi all,
I tried the following line to open another location, but it doesn't work.
print $screen - redirect(-uri='http://localhost/index.html');
It doesn't redirect to another location. It just prints the following:
Status: 302 Moved Location: http://localhost/index.html
Do you have any idea
I have a subroutine
sub xyz
{
if ($a = $b)
{
return;
}
}
When I run this in the debugger, it stays frozen on the RETURN statement.
Shouldn't the RETURN break out of the xyz subroutine?
Also, this used to work until I made some changes. Am I missing something
: Wednesday, October 24, 2001 2:47 PM
To: 'Beginner Perl'
Subject: Why doesn't RETURN work?
I have a subroutine
sub xyz
{
if ($a = $b)
{
return;
}
}
When I run this in the debugger, it stays frozen on the RETURN statement.
Shouldn't the RETURN break out of the xyz subroutine
How about if($a == $b) ?
-Original Message-
From: Gross, Stephan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 24, 2001 9:47 AM
To: 'Beginner Perl'
Subject: Why doesn't RETURN work?
I have a subroutine
sub xyz
{
if ($a = $b)
{
return;
}
}
When I run
, October 24, 2001 9:59 AM
To: 'Gross, Stephan'; 'Beginner Perl'
Subject: RE: Why doesn't RETURN work?
Hi,
'if ($a = $b)'
is not comparing $a to $b, it is assigning the value of $b into $a
If you want to test for numeric equivalence, use two '='s like
'if ($a == $b)'
Then your code should
On Wed, 24 Oct 2001, Gross, Stephan wrote:
I have a subroutine
sub xyz
{
if ($a = $b)
{
return;
}
}
When I run this in the debugger, it stays frozen on the RETURN statement.
Shouldn't the RETURN break out of the xyz subroutine?
Also, this used to work until
it didn't
equal 1.
The above says unless status equals 1 or 2, fail, which is what you need.
HTH
John
-Original Message-
From: dan radom [mailto:[EMAIL PROTECTED]]
Sent: 03 September 2001 17:00
To: [EMAIL PROTECTED]
Subject: why doesn't this work
I'm very new to perl. I have been trying
Thanks. That got it.
dan
* Jeff 'japhy/Marillion' Pinyan ([EMAIL PROTECTED]) wrote:
On Sep 3, dan radom said:
if ( $#ARGV+1 !=2 ) {
That's better written as:
if (@ARGV != 2) {
print \n;
print usage cat.pl port up\/down\n;
print \n;
exit;
}
On Sep 3, John Edwards said:
unless ( $status == (1 || 2) ) {
print \nport status must be either up or down\n\n;
exit;
} else {
system(/usr/bin/snmpset hostname password
interfaces.ifTable.ifEntry.ifAdminStatus.$port i $status);
}
The above says unless status equals 1 or
dan radom [EMAIL PROTECTED] said:
You have a logic error. The if test should be:
if (! ( $status eq 1 || $status eq 2)) {
#if (( $status ne 1 ) || ( $status ne 2 )) {
A few other style pointers follow:
You can replace this:
if ( $#ARGV+1 !=2) {
with
if ( @ARGV != 2) {
@arrayname
[EMAIL PROTECTED] said:
dan radom [EMAIL PROTECTED] said:
You have a logic error. The if test should be:
if (! ( $status eq 1 || $status eq 2)) {
Well, I know better than that. Should be = not eq.
--
Smoot Carl-Mitchell
Consultant
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
34 matches
Mail list logo