Results 1 to 2 of 2

Thread: perl question...

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 1999
    Posts
    38

    Post

    sorry, the perl forum i frequent shut down so im hoping i can get some help here.

    my question is how do i escape the backslash "\" character?

    im trying to get the name of the script thats running by spitting $0

    $0 holds "C:\~robbie\bbs\test.pl"

    @a=split(/\\/, $0); #this does NOT work!

    any help would be appreciated
    also if someone could suggest a good perl forum...

  2. #2
    Junior Member
    Join Date
    Jan 1999
    Location
    marietta, ga
    Posts
    17

    Post

    There is an easy way of getting the running script:

    first, the $0 variable holds the script and the current executing directory. To make this variable actually tell you what the script name is, just add the following code:

    ($basename = $0) =~ s%.*/%%;
    ($dirname = $0) =~ s%/[^/]*$%%;

    clear now?


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