--- "Grossner, Tim X. (AIT)" <[EMAIL PROTECTED]> wrote:
> How would I do this:
>
> file A contains a line of characters always looking like "hostname
> XXXXX".
> I want to take the XXXXX and assign that to a scalar...I tried making
> an
> array out of it by using grep to search for the line starting with
> "hostname", but then the one and only element of the array is
> "hostname
> XXXXX" and I cant figure out how to extract the XXXXX out...
>
> Any help would be greatly appreciated.
try
while(<YOURHANDLENAMEHERE>) {
($somescalar) = /hostname\s+(\w+)/;
# other code as needed . . .
}
The parens around $somescalar are necessary. =o)
=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than
you are. -- me. =o)
=============================================================
"There are trivial truths and there are great Truths.
The opposite of a trival truth is obviously false.
The opposite of a great Truth is also true." -- Neils Bohr
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/