Re: [beginner] file parsing question

2001-04-24 Thread M.W. Koskamp
- Original Message - From: Stout, Joel R <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 24, 2001 10:20 PM Subject: [beginner] file parsing question > Sorry so lengthy but here goes: > > I am a Perl newbie and trying to parse a file. Dependi

Re: [beginner] file parsing question

2001-04-24 Thread Paul
--- Timothy Kimball <[EMAIL PROTECTED]> wrote: > Ah, yes, one of the most frustrating bugs in the world: > : if ($REFln[1] = "SN") { > This *assigns* the value "SN" to $REFln[1]. What you want to do is > *test* it. String comparisons in Perl are done with "eq" (and numeric > comparisons with

Re: [beginner] file parsing question

2001-04-24 Thread Paul Johnson
On Tue, Apr 24, 2001 at 04:33:00PM -0400, Timothy Kimball wrote: > You can avoid this by always writing comparisons with the constant > (if there is one) on the left-hand side: > > if ("SN" eq $REFln) > > but I rarely see people actually do that. I think that's because it feels so unnatu

Re: [beginner] file parsing question

2001-04-24 Thread Kevin Meltzer
Hi Joel, Did you type this in by hand? :) > parseRef ($testln); > sub parseREF { You would want to change one of those! Anyways.. Your problem is in this line: > if ($REFln[1] = "SN") { = is for assignments. You want this to be: if ($REFln[1] eq "SN") { To lear

Re: [beginner] file parsing question

2001-04-24 Thread Timothy Kimball
Ah, yes, one of the most frustrating bugs in the world: : if ($REFln[1] = "SN") { This *assigns* the value "SN" to $REFln[1]. What you want to do is *test* it. String comparisons in Perl are done with "eq" (and numeric comparisons with "=="). So you want this: if ($REFln eq "SN")

[beginner] file parsing question

2001-04-24 Thread Stout, Joel R
Sorry so lengthy but here goes: I am a Perl newbie and trying to parse a file. Depending on the tags in the data I want to parse each line a different way. I built the following program to test my process. use strict; my (@lines, $testln, @REFln); while (<>) { chomp; testType