Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

pattern matching

by hnd (Scribe)
on Jun 14, 2009 at 11:08 UTC ( #771386=perlquestion: print w/replies, xml ) Need Help??

hnd has asked for the wisdom of the Perl Monks concerning the following question:

am new (not so new) to perl and am bit confused in m// operator Q1.if we use ? as the delimiter then what does that signify? Q2.we use the . operator with /s to match new lines, can you give me an example?????? can we manupilate the tcp packets i.e. how can we change the values of various falgs in the tcp packet

Replies are listed 'Best First'.
Re: pattern matching
by moritz (Cardinal) on Jun 14, 2009 at 11:27 UTC
    The answer to your first question can be found in perlop in the section Regexp Quote-Like Operators

    If you use the /s modifier, then . matches any character, including newlines. So for example:

    "a\nb" =~ m/a.*b/; # no match "a\nb" =~ m/a.*b/s; # matches

    For handling TCP packets I'd rather use an existing module from CPAN.

Re: pattern matching
by irah (Pilgrim) on Jun 15, 2009 at 04:55 UTC

    For handling TCP packets, you can look on, NetPacket::TCP module. Also look on Net::Packet::TCP module.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://771386]
Approved by linuxer
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-05-27 19:13 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (97 votes). Check out past polls.