Hi all,
I would like to extract the message that contain questions indicators like question mark and string 'what, where, who, how' at the beginning of the sentence.
herewith my code
the output that i got
-result-
1. @thekaitling Where are we going to go?
2. @schmeenarf Where are you going??
3. Half Moon Bay, home away from home. Windy, foggy, le tout industry here for Strategy 2009. Where else do AMD, Intel, & VIA share a stage?
4. @Crazycanuckblog Challah? wow, that's amazing. I wouldn't even know where to begin
5. this is where you say "hello world" i guess. reflexive, is it not?
any help is much appreciated.
I would like to extract the message that contain questions indicators like question mark and string 'what, where, who, how' at the beginning of the sentence.
herewith my code
Code:
use strict;
#use warnings;
use diagnostics;
open( INFILE, "tweets.data" )
or die("Can not open input file: $!");
open MYFILE, ">qtweet.txt";
select MYFILE;
while (<INFILE>)
{
/^\S(.*)$/ or die "Invalid input: $_";
my $tweet = $1;
if( $_ =~/\?/ ) {
print "$_";
}
elsif ($_=~m/^what/) {
print "$_";
}
elsif ($_=~m/^where/) {
print "$_";
}
else{
print "";
}
}
the output that i got
-result-
1. @thekaitling Where are we going to go?
2. @schmeenarf Where are you going??
3. Half Moon Bay, home away from home. Windy, foggy, le tout industry here for Strategy 2009. Where else do AMD, Intel, & VIA share a stage?
4. @Crazycanuckblog Challah? wow, that's amazing. I wouldn't even know where to begin
5. this is where you say "hello world" i guess. reflexive, is it not?
any help is much appreciated.