Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^7: How to extract certain range of text and display it? (snafu)

by Anonymous Monk
on Oct 14, 2013 at 06:44 UTC ( #1058132=note: print w/ replies, xml ) Need Help??


in reply to Re^6: How to extract certain range of text and display it?
in thread How to extract certain range of text and write into another file?

I used $_ but nothing prints out.

Sure it does

$ perl -l snafu $ NAME : corry $$.Inc s d $$.Oc s $$.TO G1 ty n1 EE EE M T1 T2 $$SRU G2 n1 y OO OO M T3 T4 $$SRU .EON

and here is snafu

#!/usr/bin/perl -- use warnings; use strict; my $test; my @words; #~ open(INFO,"<","testing.pl")||die"Can't open file:$!\n"; open(INFO,"<", __FILE__ )||die"Can't open file:$!\n"; chomp (@words=<INFO>); close(INFO); foreach (@words){ if(/^\$ NAME : corry/ .. /\.EON/){ $test=$_; print $test; } } __END__ $ NAME : corry $$.Inc s d $$.Oc s $$.TO G1 ty n1 EE EE M T1 T2 $$SRU G2 n1 y OO OO M T3 T4 $$SRU .EON $ NAME : patrick $$.Inc c d $$.Oc c $$.TO G1 td n3 EE EE M T5 T6 $$SRU G2 n3 y OO OO M T7 T8 $$SRU .EON

Basic debugging checklist , brian's Guide to Solving Any Perl Problem......


Comment on Re^7: How to extract certain range of text and display it? (snafu)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-08-29 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls