Re: what's wrong in systax

2001-05-08 Thread Jeff Pinyan

On May 8, Anshu Anshu said:

 22  while (IF) {
23  if (/$LOCTAG/i) {
24  ($curloc) = /VALUE=([^]+)\s*\w*/i;
25  $location .= ${curloc}::;
26  }
27
28  if (/$TYPETAG/i) {
29  ($curtype) = /VALUE=([^]+)/i;
30  $jobtype .= ${curtype}::;
31  }
32  }
33  close(IF);
34  $location =~ s/::$//;
35  $jobtype =~ s/::$//;

It would be much appreciated if you gave us an error message.  My guess is
that there are characters in $LOCTAG and $TYPETAG that Perl is using as
regex characters.  Try:

  if (/\Q$LOCTAG\E/i) { ... }
  if (/\Q$TYPETAG\E/i) { ... }

instead.  Or, consider using index() instead:

  if (index(lc, lc($LOCTAG))  -1) { ... }

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734




Re: what's wrong in systax

2001-05-08 Thread Jeff Pinyan

On May 8, John Joseph Trammell said:

On Tue, May 08, 2001 at 05:24:10PM -0400, Anshu Anshu wrote:
  22  while (IF) {
 23  if (/$LOCTAG/i) {
 24  ($curloc) = /VALUE=([^]+)\s*\w*/i;
 25  $location .= ${curloc}::;
 26  }
 27
 28  if (/$TYPETAG/i) {
 29  ($curtype) = /VALUE=([^]+)/i;
 30  $jobtype .= ${curtype}::;
 31  }
 32  }
 33  close(IF);
 34  $location =~ s/::$//;
 35  $jobtype =~ s/::$//;

Lines 24, 29; perhaps you mean =~ ?

No.  Doing:

  ($foo) = /pattern/;

is the same as:

  ($foo) = $_ =~ /pattern/;

What he's doing is getting the ()'d part of the regex, and storing it in
$curloc.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734




Re: what's wrong in systax

2001-05-08 Thread Anshu Anshu

Thanks for reply. below is the varibales as defined -

$LOCTAG = !--location--;
$TYPETAG = !-ategory--;

and error message was

Name main::JOBDATA used only once: possible typo at gen_job.pl line 14.
Name main::CP used only once: possible typo at gen_job.pl line 13.
Use of uninitialized value in substitution (s///) at gen_job.pl line 35.

Thanks
AS
- Original Message -
From: Jeff Pinyan [EMAIL PROTECTED]
To: Anshu Anshu [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, May 08, 2001 5:28 PM
Subject: Re: what's wrong in systax


 On May 8, Anshu Anshu said:

  22  while (IF) {
 23  if (/$LOCTAG/i) {
 24  ($curloc) = /VALUE=([^]+)\s*\w*/i;
 25  $location .= ${curloc}::;
 26  }
 27
 28  if (/$TYPETAG/i) {
 29  ($curtype) = /VALUE=([^]+)/i;
 30  $jobtype .= ${curtype}::;
 31  }
 32  }
 33  close(IF);
 34  $location =~ s/::$//;
 35  $jobtype =~ s/::$//;

 It would be much appreciated if you gave us an error message.  My guess is
 that there are characters in $LOCTAG and $TYPETAG that Perl is using as
 regex characters.  Try:

   if (/\Q$LOCTAG\E/i) { ... }
   if (/\Q$TYPETAG\E/i) { ... }

 instead.  Or, consider using index() instead:

   if (index(lc, lc($LOCTAG))  -1) { ... }

 --
 Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
 Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
 Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
 Acacia Fraternity, Rensselaer Chapter. Brother #734





RE: what's wrong in systax

2001-05-08 Thread King, Jason

either that or the if (/$TYPETAG/i) is not matching - so the block isn't
even being entered .. this would be most likely because even if the match on
line 29 doesn't match .. line 30 should still initialise $jobtype to (at the
very least) '::'

so my guess is that $TYPETAG doesn't appear on the line .. taking a look at
its contents - and using my Psi::ESP module .. I'm guessing that it's
because its value is

  !--ategory--

where it should be

  !--category--

but that's just a guess

-- 
  jason king

  In Hibbing, Minnesota, it shall be the duty of all policemen to kill
  all cats running at large. - http://dumblaws.com/


-Original Message-
From: Jos I Boumans [mailto:[EMAIL PROTECTED]]
Sent: Wed 9 May 2001 09:05
To: Anshu Anshu; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: what's wrong in systax


from the error msg i conclude that line 29 is not producing a 
match. You
might want to add some print statements to see whats going on there.
if it holds meta chars like japhy said, you might also want to try
quotemeta $_; so you can be sure all 'special characters' 
are escaped for
the regex.

Regards,

Jos Bouamns

- Original Message -
From: Anshu Anshu [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, May 08, 2001 11:36 PM
Subject: Re: what's wrong in systax


 Thanks for reply. below is the varibales as defined -

 $LOCTAG = !--location--;
 $TYPETAG = !-ategory--;

 and error message was

 Name main::JOBDATA used only once: possible typo at 
gen_job.pl line 14.
 Name main::CP used only once: possible typo at gen_job.pl line 13.
 Use of uninitialized value in substitution (s///) at 
gen_job.pl line 35.

 Thanks
 AS
 - Original Message -
 From: Jeff Pinyan [EMAIL PROTECTED]
 To: Anshu Anshu [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, May 08, 2001 5:28 PM
 Subject: Re: what's wrong in systax


  On May 8, Anshu Anshu said:
 
   22  while (IF) {
  23  if (/$LOCTAG/i) {
  24  ($curloc) = /VALUE=([^]+)\s*\w*/i;
  25  $location .= ${curloc}::;
  26  }
  27
  28  if (/$TYPETAG/i) {
  29  ($curtype) = /VALUE=([^]+)/i;
  30  $jobtype .= ${curtype}::;
  31  }
  32  }
  33  close(IF);
  34  $location =~ s/::$//;
  35  $jobtype =~ s/::$//;
 
  It would be much appreciated if you gave us an error 
message.  My guess
is
  that there are characters in $LOCTAG and $TYPETAG that 
Perl is using as
  regex characters.  Try:
 
if (/\Q$LOCTAG\E/i) { ... }
if (/\Q$TYPETAG\E/i) { ... }
 
  instead.  Or, consider using index() instead:
 
if (index(lc, lc($LOCTAG))  -1) { ... }
 
  --
  Jeff japhy Pinyan  [EMAIL PROTECTED]
http://www.pobox.com/~japhy/
  Are you a Monk?  http://www.perlmonks.com/
http://forums.perlguru.com/
  Perl Programmer at RiskMetrics Group, Inc.
http://www.riskmetrics.com/
  Acacia Fraternity, Rensselaer Chapter. Brother #734