Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: cgi question

by Tomtom (Scribe)
on Jun 03, 2005 at 13:44 UTC ( [id://463256]=note: print w/replies, xml ) Need Help??


in reply to cgi question

I'm not sure I really understand what you're asking for.
I have several questions/comments, though :
  • if you want to split with a pipe, you need to escape the pipe, since the pipe is a special character in regex : split /\t/, $_;
  • $GU doesn't exist; you probably mean $GU_web.
  • structure_name is supposed to be a variable, you forgot "$", and you have a ">" which isn't supposed to be there.
  • What's in your "gly_structures.txt" ? I mean, can there be duplicate $ref_num ?
  • Why do you have this loop for ?
    $i=1; while (<info_web>) { if (/^(\d+\.\d+)\D/) {$GU_web = $1;} if ($i >1) { last;} print "$GU_web\n"; $i++; }
    You're going through it only twice, assigning what you captured in the regex to $GU_web twice, and printing $GU_web only once.
  • Replies are listed 'Best First'.
    Re^2: cgi question
    by Anonymous Monk on Jun 03, 2005 at 13:53 UTC
      i noticed those variable mistakes after posting. While loop: i only want the first line and pattern match the fist set of digits. I have removed print statement; obviously not applicable in a cgi script. The basic idea is open the first file, N_Stru*
      /data/190_* /data/191_* etc
      match the numbers, then search the images folder for the number.gif. for each of the images, show these on a web page. printing them by $image which is linked the the <img src code.
        If you plan to read only the first line, then you don't need a while loop. Actually, in your loop, $GU_web is assigned twice a value : the first set of digits, and then the second, on the next line, since your "last" statement is done AFTER the assignment (that is, if your file contains digits on several lines : see tlm's answer below to match the digits).

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: note [id://463256]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2024-04-19 13:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found