4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 One problem with a routine...
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Mon Nov 29, 2004 5:47 pm (19 years, 4 months ago) Reply with QuoteBack to Top

Hi there,

I've got this problem with a routine in Perl. The code goes like this:

Code:

while($line = <FILE>) {
   if (length($line) < 2) {
      print("<br>");
   }
   elsif ( ($line =~ /\#/gi) and ($line !~ /Date/gi) ) {
      print $line."<br>";
   }
   elsif( ($line =~ /\#/gi) and ($line =~ /Date/gi) ){#this comparison
      &print_header($line);
   }
   else {   
      &print_line($line);
   }
}


The problem is that all the ifs work except for the one I signed. The line that it reads is in the form "# Date: Monday, 29 of November of 2004".
The comparison doesn't work...The previous one seems to work. If I put, for example, $line =~ /2004/gi intead of /Date/gi, it works!

Any ideas?

Kind regards,

Kepler
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.222064 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme