Help for this page

Select Code to Download


  1. or download this
        open( my $in, $infile )   or die "Couldn't read $infile: $!";
        while ( <$in> ) {
        # do something with $_
        }
        close $in;
    
  2. or download this
        sub firstline {
        open( my $in, shift ) && return scalar <$in>;
        # no close() required
        }
    
  3. or download this
      $sth->bind_param($p_num, $bind_value)
      $sth->bind_param($p_num, $bind_value, \%attr)
      $sth->bind_param($p_num, $bind_value, $bind_type)
    
  4. or download this
      $dbh->{RaiseError} = 1;        # save having to check each method ca
    +ll
      $sth = $dbh->prepare("SELECT name, age FROM people WHERE name LIKE ?
    +");
      $sth->bind_param(1, "John%");  # placeholders are numbered from 1
      $sth->execute;