#!/usr/bin/perl -w # Plain Text File Reader # Speaking version use strict; use Win32::OLE; my $voice; $voice = Win32::OLE->new("Speech.VoiceText") or die("TTS failed"); $voice->Register("", "$0"); $voice->{Enabled} = 1; $voice->{Speed}=150; my $myfile = shift; main(); sub nl { print $/; } sub main{ open (FILE, "$myfile"); my @thefile = <FILE>; close (FILE); foreach my $line (@thefile) { talk("$line"); nl(); } } sub talk{ my $line = shift; print $line,$/; $voice->Speak($line, 1); while ($voice->IsSpeaking()) { sleep 1; } }
perl -le '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat +!\n"; } else { print "Thats a dog\n"; }'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Reading Plain Text Documents
by jsprat (Curate) on Feb 28, 2003 at 02:59 UTC | |
|
Re: Perl Reading Plain Text Documents
by zentara (Cardinal) on Feb 28, 2003 at 11:57 UTC | |
by elwarren (Priest) on Mar 04, 2003 at 15:52 UTC |