Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Feedback Appreciated on text-parsing, SQL querying subroutine

by davorg (Chancellor)
on May 31, 2006 at 09:25 UTC ( [id://552732]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    unless (open(INPUT, "$inputfile"))
        {
        print "ERROR: Can't open file for reading : $!\n";
    
        }
    
  2. or download this
    open INPUT, '<', $inputfile
      or die "ERROR: Can't open file for reading : $!\n";
    
  3. or download this
    while(<INPUT>)
        {
    
  4. or download this
    my @data = split("\t", $_);
    
  5. or download this
    my @data = split /\t/;
    
  6. or download this
    my @data = split;
    
  7. or download this
    my $did1 = $data[0];
    my $did2 = $data[1];
    my $score1 = $data[2];
    my $score2 = $data[3];
    
  8. or download this
    my %rec;
    @rec{qw(did1 did2 score1 score2)} = @data;
    
  9. or download this
    my %rec;
    @rec{qw(did1 did2 score1 score2)} = split;
    
  10. or download this
    # before the loop
    my $sth1 = $dbh->prepare("select d_id, c_id from d where d_id = ?");
    ...
    # Then within the loop
    $sth1->execute($rec{did1});
    $sth2->execute($rec{did2});
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-26 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found