Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: split file and put contents in variables?

by choroba (Cardinal)
on Feb 02, 2016 at 15:14 UTC ( [id://1154276]=note: print w/replies, xml ) Need Help??


in reply to split file and put contents in variables?

Don't use print if the file can't be opened. Skip the whole program or the reading loop.

open my $test, '<', 'test.txt' or die "Can't open file: $!"; while (my $line = <$test>) { # chomp not needed with split on ' '. my ($pattern, $cyclo, $group) = split ' ', $line, 4; print $line if 'FOLDING' eq $pattern && 'SHAPE' eq $cyclo && 'OXYGEN' eq $group; } }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found