On 9/6/06, Arief Yudhawarman <[EMAIL PROTECTED]> wrote:
Saya ada masalah dg pemakaian module Tex::ParseWords di perl. Sebagai contoh script berikut: #!/usr/bin/perl use Text::ParseWords; $line = "Date :2006-09-06 10:15:30"; @words = &parse_line(':',0, $line); foreach (@words) { print "$_\n"; } Outputnya: Date 2006-09-06 10 15 30 Inginnya, hasilnya seperti ini: Date 2006-09-06 10:15:30 Ada rekan yg tahu dimana salahnya ? Terimakasih sebelumnya dan sesudahnya. Salam, ~yudi
Coba diganti jadi ini: #!/usr/bin/perl use Text::ParseWords; $line = "Date :2006-09-06 10:15:30"; @words = &parse_line(' :',0, $line); foreach (@words) { print "$_\n"; } Maaf ga bisa nyoba langsung karena lagi ga ada perl. Tapi hasi diatas terjadi karena delimiter yang dipake buat misah field adalah ':', yang juga ada diantara jam, menit, dan detik. Karena itu ganti menjadi ' :' yang merupakan string diantara kata Date dan info date-nya. -- Donny Kurnia http://hantulab.multiply.com/ http://hantulab.blogspot.com/ ------------------------------------------- At times the world can seem an unfriendly and sinister place. But believe us when we say there is much more good in it than bad. And what might seem to be a series of unfortunate events, may in fact, be the first steps of a journey. -- A Series of Unfortunate Events -- Berhenti langganan: [EMAIL PROTECTED] Arsip dan info: http://linux.or.id/milis