What I'm trying to do with the following code is convert some iCal files so that a specific application will read them.
The problem is that this application can't deal with entries that have a date but no time. (Full examples below.) For example, if I have a DTSTART:20050616 in the file, I want to convert it to: DTSTART:20050616T070000Z But with my code below this line prints as: T070000Z20050616 overwriting instead of appending the time value. It seems like this should be simple, and because of that I'm getting kind of frustrated with this -- damn it I should be able to do this. I've tried several different things and they all overwrite instead of append. I've tried: s/$/T070000Z\n/; my $startline=$ . "T070000Z\n"; and my $startline= join "",$_,"T070000Z\n"; And get the same results with each of them. My code: (the last stanza, where I append a ",*" is because I'm also trying to convert the data to a public calendar too. But it does the same thing, overwrites the beginning of the line instead of appending.) #!/usr/bin/perl # convert # usage: convert <filenames> use warnings; use strict; foreach my $argnum (0 .. $#ARGV){ my $inputfile = $ARGV[$argnum]; open FILE, '<', $inputfile or die "Cannot open $inputfile: $!"; while ( <FILE> ) { chomp $_; if (/DTSTART:/) { my $startline= $_ . "T070000Z\n"; print $startline; } elsif (/DTEND:/) { s/$/T170000Z\n/; print $_; } elsif (/X-SQ-EVTOWNERS:/) { my $ownerline = join "", $_, ",*\n"/; print $ownerline; } else { print $_."\n"; } } close FILE; } Sample data: BEGIN:VEVENT UID:sm_cal_evt_20050523T201350Z_example_com SEQUENCE:0 PRIORITY:5 DTSTAMP:20050523T201350Z CREATED:20050523T201350Z LAST-MODIFIED:20050523T201350Z STATUS: DTSTART:20050616 SUMMARY:Someguy - PTO DESCRIPTION: COMMENT: DTEND:20050616 X-SQ-EVTDOMAIN:zeffert_com X-SQ-EVTCREATOR:mikeprice X-SQ-EVTLASTUPDATOR:someguy X-SQ-EVTOWNERS:kodak,someguy X-SQ-EVTREADABLEUSERS: X-SQ-EVTWRITEABLEUSERS: X-SQ-EVTPARENTCALENDARS:sm_cal_20050401T193810Z_example_com END:VEVENT Thanks in advance for any help, --J(K) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>