Guay Jean-SÃbastien wrote:
> I am sorry David, it just seems like I am having trouble communicating
> clearly. We are apparently in a disagreement, but your points are not at
> all what I wanted to explain... I'll try again.
i totally understand what you are saying and like i said before, your po
Hello Joseph, David,
> A stronger argument has to do with mindset. The || operator is an
> expression evaluation operator, appropriate to mathematical or
paramathematical
> expressions. The context really calls for a flow-control operator, or.
Thanks for making my point better than I could, Jos
Hello Joseph,
> One thing I would request is that you trim off any material to which you
are not
> responding from old posts. This helps keep bandwidth and storage needs
down.
I'll keep that in mind. I usually don't keep all the thread of replies that
Outlook ( grrr) keeps at the bottom, seems l
I am sorry David, it just seems like I am having trouble communicating
clearly. We are apparently in a disagreement, but your points are not at all
what I wanted to explain... I'll try again.
> you should test it yourself. i am not sure how good you are
> with Perl and i
> don't want to sound lik
Paul Johnson wrote:
> On Sun, Apr 04, 2004 at 01:28:42PM -0700, R. Joseph Newton wrote:
>
> > Guay Jean-Sébastien wrote:
> > >
> > > my $errors = 0;
> > > open (CRITICALSERVERS, "$crout") || $errors += 2;
> > >
> > > that will translate to:
> > >
> > > my $errors = 0;
> > > ( open (CRITICALSERVERS
On Sun, Apr 04, 2004 at 01:28:42PM -0700, R. Joseph Newton wrote:
> Guay Jean-Sébastien wrote:
> >
> > my $errors = 0;
> > open (CRITICALSERVERS, "$crout") || $errors += 2;
> >
> > that will translate to:
> >
> > my $errors = 0;
> > ( open (CRITICALSERVERS, "$crout") || $errors ) += 2;
>
> Nope.
Guay Jean-Sébastien wrote:
>
> There is no problem syntactically. But there is a problem with the
> precdence. If you ever have another operation on either the left or right
> side of the || operator, the || operator will bind tighter than the other
> operation. So for example, if you do:
>
> my $
david wrote:
> Guay Jean-Sébastien wrote:
> >
> >> open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
> >
> > As I said, you should replace || by or in the above line. See the
> > precedence rules in "perldoc perlop" for details.
> >
>
> why do you think so? is there any problem in
Guay Jean-Sébastien wrote:
> Hello Derek,
>
> > Guay,
>
> Err, my first name is Jean-Sebastien.
Hi Jean-Sebastien,
> My last name is Guay. French-language
> people have a bad habit to put the last name first, as in "Guay,
> Jean-Sebastien"... So I understand why this is a bit confusing.
Thanks
[EMAIL PROTECTED] wrote:
> Yet another great explanation..
What explanation? I see niothing above this. Please do not top-post when
posting to this list. Instead, follow the material to which you are directly
responding with your response, then trim any extraneous material. Most of us
keep re
Guay Jean-SÃbastien wrote:
>> Guay Jean-SÃbastien wrote:
>>>
open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
>>>
>>> As I said, you should replace || by or in the above line. See the
>>> precedence rules in "perldoc perlop" for details.
>>
>> why do you think so? is there
Hello Derek,
> can I email you from know on??? : ) You are so through! Thank you!
No, I would prefer that you always reply to the list. First reason is that
other beginners can benefit from our exchange (and the mails end up in a
searchable archive), second is that if I'm not there (or for th
construct
instead of the array assuming memory is not an issue?
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Guay Jean-Sébastien <[EMAIL PROTECTED]>
04/02/2004 02:20 PM
To: Perl Beginners <[EMAIL PROTECTED]>
cc:
Subject: RE: using strict
> Guay Jean-SÃbastien wrote:
>>
>>> open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
>>
>> As I said, you should replace || by or in the above line. See the
>> precedence rules in "perldoc perlop" for details.
>
> why do you think so? is there any problem in the above line?
The
Guay Jean-SÃbastien wrote:
>
>> open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
>
> As I said, you should replace || by or in the above line. See the
> precedence rules in "perldoc perlop" for details.
>
why do you think so? is there any problem in the above line?
david
--
s
t $line . "\n";
}
As you can see, it is very similar, but since we get the whole file into the
array, we can close it right after, and also we loop over the array instead
of looping and getting one line at a time until we get to the end of the
file.
Hope this helps,
Jean-Sébasti
[EMAIL PROTECTED] wrote:
Yet another great explanation... thank you! But I still need to know how
to print each specific element # along with its data?
Is this the right way to go for storing each line in its own element???
while $line < FILEHANDLE >
my @tsm = < FILEHANDLE >
foreach $_ (@tsm)
int $_ , "\n";
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
[EMAIL PROTECTED]
04/01/2004 06:02 PM
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject: Re: using strict
In a message dated 4/1/2004 5:03:40 PM Eastern Standard Time,
[E
t;
cc:
Subject:RE: using strict
Hello Derek,
When using strict, the error message should point you to the line where
the
error is. It's usually pretty darn good at pointing the right line. In
this
case, I bet it's this one:
>while ( defined($line = )
[EMAIL PROTECTED] wrote:
Does the following turn off strict for a vars?
no strict "vars";
Could you also turn off strict for other things besides vars, refs and subs? Say for a subroutine (for example).
Pragma are block/file scoped similar to a lexical. To answer your
question below, yes you c
In a message dated 4/1/2004 5:03:40 PM Eastern Standard Time,
[EMAIL PROTECTED] writes:
People of the Perl,
>from my understanding strict disallows soft references, ensures that all
>variables are declared before usage and disallows barewords except for
>subroutines.
>
>what is a soft referen
Does the following turn off strict for a vars?
no strict "vars";
Could you also turn off strict for other things besides vars, refs and subs? Say for
a subroutine (for example).
Just curious. I've run into situations where I've come across badly maintained code
and would like to do this for
On 4/1/2004 5:01 PM, [EMAIL PROTECTED] wrote:
People of the Perl,
from my understanding strict disallows soft references, ensures that all
variables are declared before usage and disallows barewords except for
subroutines.
what is a soft reference?
what is a bareword?
why is strict disallowin
--As of Thursday, April 1, 2004 5:01 PM -0500, [EMAIL PROTECTED] is
alleged to have said:
what is a soft reference?
what is a bareword?
why is strict disallowing a compile here When I comment out strict
the syntax checks outs as ok!???
how do I display each element # with its corresponding
Hello Derek,
When using strict, the error message should point you to the line where the
error is. It's usually pretty darn good at pointing the right line. In this
case, I bet it's this one:
>while ( defined($line = ) ) {
There is no declaration of the $line variable. Try declaring it f
> -Original Message-
> From: Robert "Beau" Link [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 30, 2002 8:27 PM
> To: [EMAIL PROTECTED]
> Subject: using strict and -w
>
> ... And where might I have found that answer within
> perldoc? I tried > perldoc -q strict and got "No documentat
On Tuesday, April 30, 2002, at 05:27 , Robert Beau Link wrote:
[..]
> #!/usr/bin/perl -w
>
> use strict;
>
> print "Number, please...";
> $alpha = ;
> print "Another, please...";
> $beta = ;
> $sum= $alpha + $beta;
> $diff = $alpha - $beta;
> $product = $alpha * $beta;
> $quotient = $alpha / $bet
--- Dermot Paikkos <[EMAIL PROTECTED]> wrote:
> Hi Gurus,
>
> I am trying to get tidy with my scripts and want to
> use Strict
Use lowercase for strict! Anything else will cause havoc.
> but am having difficulty with return values from
> subroutines. I have the following snippet:
>
> whi
> -Original Message-
> From: Dermot Paikkos [mailto:[EMAIL PROTECTED]]
> Subject: Using strict and getting return values
>
> Hi Gurus,
Well, I'm definitely not a guru, but I think I might be able to help... :)
>
> I am trying to get tidy with my scripts and want to use Strict but am
>
Deborah Strickland wrote:
>
> Hi,
> I can't find the answer to this in any of my many Perl books so I'm
> asking you. I want to do 'use strict' but when I also use it with a file
> handle I get an error. How can I declare a file handle variable such
> that 'use strict' won't generate an error?
>
On Wed, 27 Jun 2001, Brett W. McCoy wrote:
> But you can't say $file = "CHR1", beacuse then you are creating a symbolic
> reference to a filehandle. Very bad. Do this instead:
>
> $file = *CHR1;
>
> Then you can properly use your filehandle. What you really want to do is
> create an array of o
On Wed, 27 Jun 2001, Hans Holtan wrote:
> I forgot to mention that I did open the output files earlier in the
> program, ie CHR1, CHR3 ... CHR5.
But you can't say $file = "CHR1", beacuse then you are creating a symbolic
reference to a filehandle. Very bad. Do this instead:
$file = *CHR1;
The
On Wed, 27 Jun 2001, Hans Holtan wrote:
> I get this error when I run my script, and I don't understand why:
>
> "Can't use string ("CHR3") as a symbol ref while "strict refs" in use
> at AtIntergenicTableSort.pl line 53. "
>
> I'm trying to split my output into 5 seperate files based on what is
On Wed, Jun 27, 2001 at 04:54:17PM -0700, Paul wrote:
> Another trick -- use FileHandle and put them into an array.
>
> my @FILE;
> for (1..5) {
> $FILE[$_] = new FileHandle "CHR$_" or die "CHR$_: $!";
> }
>
> now you can say:
>
> print $FILE[$_] ">$k\t$all_genes{$k}\n";
This do
On Wed, Jun 27, 2001 at 04:53:04PM -0700, Hans Holtan wrote:
> #!usr/bin/perl -w
> use strict;
Add:
use IO::File;
>
>
> my ($input,$output,$k,$v,$gene, $input_string,
Replace this:
> $output1,$output2,$output3,$output4,$output5,
with this:
@filehandles,
> $file, $junk,$i,
--- Stephen Nelson <[EMAIL PROTECTED]> wrote:
> Fortunately or unfortunately, you can't print to files just by using
> $file
> as a filehandle. You need to open the file first.
>
>
> foreach $k (sort keys (%all_genes)) {
> for (1..5){
> if ($k =~ /[$_]g/){
>
Fortunately or unfortunately, you can't print to files just by using $file
as a filehandle. You need to open the file first.
foreach $k (sort keys (%all_genes)) {
for (1..5){
if ($k =~ /[$_]g/){
$file = "CHR$_";
ope
37 matches
Mail list logo