David Gilden wrote: > I am not sure I have the syntax quite right here, any suggestions would be > welcome. > > $line = "Friday, June 23, 2006 12:30 PM" ; > > $last_updated = substr($line, 0, (length($line) -9)); # remove the time > part of time stamp > # the above line is throwing an error
Hi David As others have said, your code works fine as you have it, but you may prefer a solution using a regular expression as Tom has suggested. This code looks for whitespace followed by digits and a colon, and deletes from there to the end of the string. HTH. use strict; use warnings; my $line = "Friday, June 23, 2006 12:30 PM" ; $line =~ s/\s+\d+:.*$//; print "|$line|\n"; OUTPUT: |Friday, June 23, 2006| -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>