Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: How do I strip lines prefixed by a

by pppaulll (Initiate)
on Nov 29, 2001 at 21:23 UTC ( #128407=categorized answer: print w/replies, xml ) Need Help??

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

This bypasses lines where # is in column 1 and blank lines.
STLOAD: foreach $line (<INFILE>) { chomp $line; $line_header = substr($line, 0, 1); # Ignore comments (#) and blank lines # including 0-n spaces. if ($line_header eq '#' || $line =~ /^ *$/) { next STLOAD; } elsif ($line_header eq '@') { # Specifies: targ host, path, file $ts_cnt ++; if ($ts_cnt > 1) ...

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 meditating upon the Monastery: (4)
As of 2016-09-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (474 votes). Check out past polls.