Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: How to extract certain range of text and display it?

by annel (Novice)
on Oct 14, 2013 at 02:05 UTC ( #1058116=note: print w/replies, xml ) Need Help??


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

Here is the code I updated. Please check it. Thanks.
use warnings; use strict; my $test; my @words; open(INFO,"<","testing.pl")||die"Can't open file:$!\n"; chomp (@words=<INFO>); close(INFO); foreach @words){ if(/^\$ NAME : corry/ .. /\.EON/){ $test=$1; print $test; } }

Replies are listed 'Best First'.
Re^5: How to extract certain range of text and display it?
by Anonymous Monk on Oct 14, 2013 at 02:18 UTC

    well, you're using $1 without using capture groups which moritz told you about , and which perlintro talks about ($1)

    why are you using $1, maybe you want to use $_?

      use warnings; use strict; my $test; my @words; open(INFO,"<","testing.pl")||die"Can't open file:$!\n"; chomp (@words=<INFO>); close(INFO); foreach (@words){ if(/^\$ NAME : corry/ .. /\.EON/){ $test=$_; print $test; } }
      I used $_ but nothing prints out.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058116]
help
Chatterbox?
[Corion]: ambrus: AnyEvent(::HTTP) doesn't integrate well with Prima, that's my main problem
[Corion]: There is a weirdo shim because there is a POE integration for Prima, and if you use that, you can use the POE adapter of AnyEvent. What I'd want is something transport agnostic that parses HTTP or produces HTTP output, so that the communication with ...
[Corion]: ... the socket is done by my code. Ideally that module would not be based on callbacks ;)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2016-12-07 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.