OK Here is what I am doing. I am doing a SELECT into a Database. It gets a few fields which are all in the same format (12/03/2001 12:00:01.000). What I need to do is to look at each field. If they fall in that format (MM/DD/YYYY HH:MM:SS.XXX) trim that .XXX off. How would you all suggest I do this? I know I need to do some sort of pattern match but due to I suck at regex (It is extremely hard for me to learn I am finding out) I am not sure how to go about this.... Here is my foreach statement:
foreach my $line (@rows) {
$line =~ s/\t/\x09/ig;
$line =~ s/\n/\x0A/ig;
$line =~ s/\r/\x0D/ig;
$line =~ s/"/'/ig;
print FILE "\"$line\",";
$cell++;
}
Thank you all loads for any help...
-----------------------
Billy S.
Slinar Hardtail - Hand of Dane
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster
perl -le '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat
+!\n"; } else { print "Thats a dog\n"; }'
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.