Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Cannot find the error

by tybalt89 (Monsignor)
on Apr 03, 2020 at 19:37 UTC ( [id://11115004]=note: print w/replies, xml ) Need Help??


in reply to Cannot find the error

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11114988 use warnings; my @lines = ("t13:45\n", "D13:45\n", "S13:45 Unicorn\n","D13:45\n", "S13:45\n", "T13:45\n", "t13:45\n", "D13:45\n", "T13:46\n","t13:45\n +", "D13:45\n", "S13:45\n","D13:45\n", "S13:45 UNICORN\n", "T13:45\n", "t13:45\n", "D13:45\n", "T13:46\n"); my $value = 'unicorn'; my @sections = grep /$value/i, (join '', @lines) =~ /^t.*?\nT.*?\n/gms +; print join "\n", @sections; # so there is a gap between sections

Outputs:

t13:45 D13:45 S13:45 Unicorn D13:45 S13:45 T13:45 t13:45 D13:45 S13:45 D13:45 S13:45 UNICORN T13:45

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found