D
dangelsocket
This is a question i'm sure has been asked before but i can't see to dig a
a answer.
say your recieving a text stream:
contained in $stream. ( only available as a string )
say you need to find numerous occurances of a string in $stream.
like:
for ( $stream ) {
(/match_this/) ? print 'match this'; : my $nada;
}
# because $stream is being recieved as a 'plain string', this script
will only match the first occurance of /match_this/ (even if it occurs many
times,
of course the 'g' and 'm' modifiers are irrevelent in this situtation.
What i ended up doing was something like @list = split(/\w+/, $stream);
which works
but it seems that there is another way to do this (of course)
( almost like a backwards chomp like - add newline, or define $/ somewhere
)
a answer.
say your recieving a text stream:
contained in $stream. ( only available as a string )
say you need to find numerous occurances of a string in $stream.
like:
for ( $stream ) {
(/match_this/) ? print 'match this'; : my $nada;
}
# because $stream is being recieved as a 'plain string', this script
will only match the first occurance of /match_this/ (even if it occurs many
times,
of course the 'g' and 'm' modifiers are irrevelent in this situtation.
What i ended up doing was something like @list = split(/\w+/, $stream);
which works
but it seems that there is another way to do this (of course)
( almost like a backwards chomp like - add newline, or define $/ somewhere
)