Re: Date::manip query

2007-12-19 Thread pauld
im sorting it on a key of the hash my @daylistsorted = sort { $$a{'START_DS'} <=> $$b{'START_DS'} } @daylist; generates a Argument "2007:09:30 13:41" isn't numeric in numeric comparison (<=>) at ./518573 error my @daylistsorted = sort { $$a{'START'} <=> $$b{'START'} } @daylist; works -- To u

Re: Date::manip query

2007-12-18 Thread pauld
the END_DS field is the date field that I want - but as I couldnt get it back from the seconds since epoch field I included it. IMHO it would be tideir to just use the (numerical) date-seconds and convert it back as necessary . i used the Date::Manip function Date_SecsSince1970($m,$d,$y,$h,$mn,$

Re: Date::manip query

2007-12-17 Thread pauld
im importing data from an excel spreadsheet into an array of hashes. the date is initially converted using Date::Format::Excel. for this bit {START} = unix start time .{START_DS} = string that I use to convert to unixtime with my $var=0;my [EMAIL PROTECTED]; while ($var<$va_length) { print "${$d

Date::manip query

2007-12-16 Thread pauld
im using Date::Manip to convert dates and times eg 2007:08:02 12:23 to allow me to sort them, which it does . but I cant see how to get the number back into a human -readable format print scalar localtime($var{STARTTIME}); prints the long string . is there a better way to get just the bits I wan

getting data from excel

2007-12-04 Thread pauld
i want to extract data from an excel spreadsheet into a hash of hashes so row 1 @headings= [col0,col1,col2 etc ] then i can loop through the rest ,extract the data a row at a time then i can for each row @columns = [col0,col1,col2 etc ] @[EMAIL PROTECTED]@columns; and then $alldata{rownumber}=\%

Re: why "cant execute " error ?

2007-10-15 Thread pauld
thank you . this is why it cant execute Can't execute: called with 1 bind variables when 0 are needed my $sql="SELECT value,text FROM res_prior"; has no bound variables - or has it ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.

why "cant execute " error ?

2007-10-14 Thread pauld
# now connect and get a database handle my $dbh = DBI->connect($dsn, $user, $pass) or die "Cant connect to the DB: $DBI::errstr\n"; my $sql="SELECT value FROM res_prior"; my $sth = $dbh->prepare($sql) or die "cant prepare"; $sth->execute($sql) or die "cant execute"; and i get a "cant execute" erro

Re: perl sort query

2007-06-19 Thread pauld
> $ perl -le' > print for @x = qw/200610011733 200610012057 200610011029 200610010928 > 200610011220/, ""; > > print for sort @x; > ' > 200610011733 > 200610012057 > 200610011029 > 200610010928 > 200610011220 > the time is the last 4 digits (hhmm) so the first is 17:33 then 20:57 then 10:29 then

perl sort query

2007-06-18 Thread pauld
I want to sort a hash of hash by date&time and then extract some of the data. >From the data ive got i can contruct a key that is mmddhhmm and i do this ##error trap absent entries if ($endan=~m/\d{2}:\d{2}\s+\d{2}/ && $stan=~m/\d{2}:\d{2}\s+\d{2}/ ) {my %daylist; ##split start and

Re: accesing a hash of an array of hashes

2007-05-28 Thread pauld
thanks for the help - im looking up hash slices - but id like to get something that works and then i can add new ideas etc so im going to leave it as it for the time being. Data::Dumper has helped sort out where an error is coming #!/usr/bin/perl -w use strict; use warnings; open O, "<$file" or

accesing a hash of an array of hashes

2007-05-26 Thread pauld
ive read a load of data in from a CSV file with Text::CSV and ended up with a hash (%hash) where the keys are the column labels. my @headings=split(/,/,$rows[0]) and then for (my $j=1;$j<$#rows;$j++) { my $status = $csv->parse ($rows[$j]); # parse a CSV string into fields my @columns = $csv->

regex and pattern matching

2002-02-05 Thread PaulD
Hi All, Trying to figure out something that should be easy.. If $value_a contains $value_b then Problem is I don't know how to escape the entire variable $value_a so that the . is not considered a quantifier. $value_a = ".com";