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

Re: ignoring blank lines

by linuxer (Deacon)
on May 25, 2010 at 18:36 UTC ( #841620=note: print w/ replies, xml ) Need Help??


in reply to ignoring blank lines

Hi, your shebang looks broken... Shouldn't it be #! |path|of|interpreter (1)?

your subject says "ignoring blank lines", your text says "leave out those lines which has one partner"?

So, what do you want to do?

What do you mean with "partner"? Are you talking about words (partner == word)?
Do you simple want to print those lines with two words?
Maybe only those lines with two words, where the words are the same?

The better you explain your problem, the better others can help you.

Just a guess:

#! /usr/bin/perl use strict; use warnings; # read magically from given files or STDIN; see perldoc perlop (null f +ilehandle) while ( my $line = <> ) { # split each line my @elements = split /\s+/, $line; # two words per line (and words are equal) if ( 2 == @elements && $elements[0] eq $elements[1] ) { print $line; } } # just for testing __DATA__ file ass ass array rat rasa arrow ant sad
edit: (1): and I wonder whether there shouldn't be slashes /? Which OS uses pipe | as directory separator?


Comment on Re: ignoring blank lines
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-07-28 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (207 votes), past polls