Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Question on File position, pulling words

by Punitha (Priest)
on Mar 04, 2008 at 04:49 UTC ( #671789=note: print w/replies, xml ) Need Help??

in reply to Question on File position, pulling words

Consider your variables are separated by space, then you can try like,

use strict; while(<DATA>){ chomp; print "IN:$&\n" if($_ =~/\s[^\s]+\s[^\s]+$/); }


Replies are listed 'Best First'.
Re^2: Question on File position, pulling words
by taints169 (Initiate) on Mar 04, 2008 at 15:29 UTC
    Perfect thanks everyone! If I wanted to break up the line into 2 seperate variables, would I just search on the space then replace with a new line? I'd like to be able to assign a variable to each one and call each one.
    host_crm-unitc-01_01 server_one_ear-unitc to get: host_crm-unitc-01_01 server_one_ear-unitc

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://671789]
[choroba]: Snow here. Good morning nonetheless.
[Corion]: A good morning to you too, Discipulus!
[Discipulus]: ah! buran stroke again?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-03-19 08:04 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (236 votes). Check out past polls.