Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Between START .. END

by ioannis (Abbot)
on Sep 14, 2005 at 11:28 UTC ( #491823=note: print w/replies, xml ) Need Help??


in reply to Between START .. END

# if START and END occur only once, we could lock it with m??
while (<DATA>) { next unless my $count = ?start?../end/; next if $count == 1; print; }

Replies are listed 'Best First'.
Re^2: Between START .. END
by softworkz (Monk) on Sep 14, 2005 at 17:00 UTC
    Here's a regex that would do the trick.

    #!/usr/bin/perl -w use strict; while (<DATA>) { $_ =~ tr/!@#$%^&*//d; # will you encounter funky chars? next unless ($_ =~/(^\d+)/); print $_; } __DATA__ START 1 2 3! 4 5 END START 1* 2 3 4 5 6 END

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-12-08 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?