Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: matching lines in a long string

by haukex (Archbishop)
on May 30, 2020 at 19:59 UTC ( [id://11117512]=note: print w/replies, xml ) Need Help??


in reply to matching lines in a long string

Athanasius and AnomalousMonk already explained the issue. I just wanted to add: The most performant way is the following; it avoids splitting the lines into a list first.

use warnings; use strict; my $s = <<'EOF'; int t; //variable t t->a=0; //t->a does;; something printf("\nEnter the Employee ID : "); scanf("%d", ptrx->eid); //employee id ptrx->eid printf("\nEnter the Employee Name : "); scanf("%s", ptr->name); return 0; EOF open my $fh, '<', \$s or die $!; while ( my $line = <$fh> ) { chomp($line); print "<$line>\n"; } close $fh;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-16 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found