On 23-Aug-1999, Khadiyd Idris wrote:
> buatin contoh program perl yang
> meng ekstrak title dari sebuah file html
> tapi menggunakan regular expression (pattern matching)
>
> misal:
> <html><title>
> I'm a newbie</title>
> </html>
>
> titlenya "I'm a newbie"
One-liner nih :)
#!/usr/bin/perl -n -0
/<title>(.*)<\/title>/si; print $1;
simpen ke file, misalnya gettitle.pl, trus chmod +x, pakenya:
$ ./gettitle.pl file.html
atau
$ ./gettitle.pl < someotherfile.html
--
Ronny Haryanto
@p=split(//,",rekcah lreP rehtona tsuJ");p:print pop(p);goto p if @p;
--------------------------------------------------------------------------------
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3
Pengelola dapat dihubungi lewat [EMAIL PROTECTED]
Hosted by http://www.Indoglobal.com