I am very very new to PERL, and quite ashamed to ask, thinking that my problem may just be really very simple to the monks. The following is my code:
#!/usr/bin/perl
use strict;
use DBI;
#Connect to the database
my $dbh= DBI->connect('DBI:mysql:my_database','my_name','my_password')
+ or die
"Couldn't open database: "$DBI::errstr;stopped";
$dbh->disconnect();
Trouble is, when I run it just to check the connection, it gets an error at the third line of the code, the part which says "Use DBI;". Please, what could be wrong? I'm pretty excited to learn PERL..!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.