Subdomain Posts
None | 7 hours ago
None | 1 day ago
None | 5 days ago
None | 6 days ago
Bash | 6 days ago
None | 9 days ago
None | 9 days ago
C++ | 12 days ago
unrealScript | 15 days ago
None | 15 days ago
Recent Posts
None | 9 sec ago
None | 21 sec ago
Java | 24 sec ago
None | 35 sec ago
None | 42 sec ago
None | 54 sec ago
HTML | 56 sec ago
None | 57 sec ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By root on the 30th of Jun 2009 01:02:19 PM Download | Raw | Embed | Report
  1. #!/usr/bin/perl
  2. use strict;
  3. use DBI;
  4.  
  5. sub db_connect {
  6.         my $dsn = "delfi;host=localhost;mysql_enable_utf8=1";;
  7.         my $dbh = DBI->connect("dbi:mysql:$dsn", "mysql", "", { PrintError => 0, RaiseError => 1 });
  8.  
  9.         return $dbh;
  10. }
  11.  
  12. my $dbh = db_connect();
  13. my $sth = $dbh->prepare("SELECT name FROM newsCategories WHERE ID=?");
  14. $sth->execute(2);
  15. my ($rootname) = $sth->fetchrow or die 'Non existing root category';
  16. print "rex: ", $1, "\n" if $rootname =~ /^(...)/;
  17. print "substr: ", substr($rootname, 0, 3) . '...';
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: