Hello:
 
I'm very excited when I discovered the map function, however, I cannot seem to get it 
to do what I want in this instance:
 
  chomp (my @strings = `strings *`);
  my $var;
  my @ptrRecords = map ((/.*\s+PTR\s+.*/), @strings );   #  <- LINE IN QUESTION
  foreach (@ptrRecords) { print "$_\n" };

What I am trying to do is get all PTR records in a DNS BIND directory into 
@ptrRecords, e.g., 

  What I'm gettingin @ptrRecords (1 = scalar match):
  1
  1
  [...]
 
  What I want in @ptrRecords (actual match string):
  12   PTR ldsslcs_cab4_12.infra.chq.slc.ut.usa.wh.lds.
  13   PTR ldsslcs_cab4_13.infra.chq.slc.ut.usa.wh.lds.
  [...]
 
 
I'd really appreciate some help figuring out where I'm going wrong.  I know I could 
iterate through @strings using a while loop and push statements to @ptrRecords, but 
I'd rather use the map function which seems far more elegant to me.  I'm hoping to be 
a Perl idiot savant someday, but I obviously have a ways to go (at least in the savant 
category).
 
Thanks!
 
Lance
 
-----------------------------------------------------------------------------
 "Better to do a little well than a lot poorly" (Socrates)


------------------------------------------------------------------------------
This message may contain confidential information, and is intended only for the use of 
the individual(s) to whom it is addressed.


==============================================================================

Reply via email to