Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: simple regex question

by beowulf (Scribe)
on Mar 03, 2001 at 07:31 UTC ( [id://61960]=note: print w/replies, xml ) Need Help??


in reply to simple regex question

Assuming that you want just the lines that have 1 and then whitespace after that, and then text the following code will work

if (/^1\s+/) { print FILE, "$_\n"; }
Life? What's a life?

Replies are listed 'Best First'.
Re: Re: simple regex question
by Chmrr (Vicar) on Mar 03, 2001 at 07:37 UTC
    A more general solution might be /^1\b/. Of course, the previous suggestion will almost certainly work also, but in the spirit of TIMTOWTDI, and not fully knowing the format of the data..

     
    perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'

      A more general solution might be /^1\b/.

      ...or, borrowing from Tuna below: /^1\D/.

      p
      I was thinking about that too, actually
      Life? What's a life?
Re: Re: simple regex question
by Rudif (Hermit) on Mar 04, 2001 at 03:37 UTC
    Life? What's a life?
    anagram of a file? an ordered sequence ending with EOL?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://61960]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found