Results 1 to 5 of 5

Thread: Perl Regx

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Perl Regx

    Can anyone helps me with Perl programming about Regx?

    In txt file it has

    Entry: This entry# 2 has been DELETED

    I wrote a string match:

    $string =~ m/^This\s.*/ig;

    Basicially, I have an if statement that compares that $string with another string...

    So if ($another string ne $string) {print something out}
    else { don't print}

    My match $string seems not working at all... my $another string's string has different text, it keeps saying "Don't print"

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: Perl Regx

    Hello?

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Perl Regx

    What does $string contain prior to the match, and what do you expect it to contain afterwards?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: Perl Regx

    The $string basically matches the words that start with "This" in that text file.... it's just a variable declaration.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Perl Regx

    I want to see you initial assignment to $string, and I want to see the exact code of what you do with it afterwards. My point is, this line:
    Code:
    $string =~ m/^This\s.*/ig;
    doesn't change the contents of $string, but I think you believe it does.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width