eq and =? problem?

Discussion in 'Perl' started by Geoff Cox, Mar 20, 2007.

  1. Geoff Cox

    Geoff Cox Guest

    Hello,

    It would seem that the following code does not distinguish between the
    "bp" and the "bplanning". I thought that using eq and not =~ would
    work.

    Any ideas please?

    Cheers

    Geoff

    elsif ( $path eq
    "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
    intro($path);
    appliedbusinessclassroomnotesedexcelunit2bp($path);
    }

    elsif ( $path eq
    "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
    intro($path);
    appliedbusinessclassroomnotesedexcelunit2bplanning($path);
    }
    Geoff Cox, Mar 20, 2007
    #1
    1. Advertising


  2. > Any ideas please?


    This works just fine for me.

    How about providing the full script or a simple testcase?
    Adrian Ulrich, Mar 20, 2007
    #2
    1. Advertising

  3. Geoff Cox

    Geoff Cox Guest

    On Tue, 20 Mar 2007 10:41:29 +0100, Adrian Ulrich
    <> wrote:

    >
    >> Any ideas please?

    >
    >This works just fine for me.
    >
    >How about providing the full script or a simple testcase?


    Adrian,

    Thanks for your reply . odd!

    I will try again myself. As it stands I am taking info from a MySQL
    data base, a collection of php files and html files so not easy to
    come up with a simple test case but will give this a try.

    I found a solution by changing the bp to bisplans to avoid any
    confusion between bp and bplann.

    How did you test out the code I posted?!

    Cheers

    Geoff
    Geoff Cox, Mar 20, 2007
    #3
  4. > I found a solution by changing the bp to bisplans to avoid any
    > confusion between bp and bplann.


    Maybe something adds some weird/unwanded chars to $path

    print unpack("H*", $path)."\n";

    should display them.


    > How did you test out the code I posted?!


    #!/usr/bin/perl
    use strict;
    my $path = "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning";
    if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
    die "1\n";
    }
    elsif ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
    die "2\n";
    }
    else {
    die "3\n";
    }
    Adrian Ulrich, Mar 20, 2007
    #4
  5. Geoff Cox

    Geoff Cox Guest

    On Tue, 20 Mar 2007 21:54:51 +0100, Adrian Ulrich
    <> wrote:

    >> I found a solution by changing the bp to bisplans to avoid any
    >> confusion between bp and bplann.

    >
    >Maybe something adds some weird/unwanded chars to $path
    >
    >print unpack("H*", $path)."\n";
    >
    >should display them.
    >
    >
    >> How did you test out the code I posted?!

    >
    >#!/usr/bin/perl
    >use strict;
    >my $path = "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning";
    >if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
    > die "1\n";
    >}
    >elsif ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
    > die "2\n";
    >}
    >else {
    > die "3\n";
    >}



    Thanks Adrian - will give that a go.

    Cheers

    Geoff
    Geoff Cox, Mar 20, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    0
    Views:
    1,011
  2. Replies:
    1
    Views:
    2,356
  3. titi

    if and and vs if and,and

    titi, Mar 9, 2007, in forum: VHDL
    Replies:
    4
    Views:
    583
    Mike Treseler
    Mar 11, 2007
  4. John Walsch
    Replies:
    0
    Views:
    197
    John Walsch
    Jul 9, 2004
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    545
    Bullschmidt
    May 11, 2004
Loading...

Share This Page