Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Answer: How do I strip lines prefixed by a

( #38281=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > How do I strip lines prefixed by a "#" contributed by runrig

Simplest is to:
while (<INFILE>) { next if /^#/; # or next if substr($_,0,1) eq '#'; $content .= $_; };

Comment on Answer: How do I strip lines prefixed by a
Download Code
Replies are listed 'Best First'.
RE: Answer: How do I strip lines prefixed by a
by Coplan (Pilgrim) on Oct 25, 2000 at 07:37 UTC
    Ok....that works great!

    But I am (unfortunately) a beginner Perl Hacker. So could you (or someone) please explain what exactly you did?

    I think it's the ^ that confuses me a bit.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-08-30 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (348 votes), past polls