How would I get the various elements out of a string of known format.
A previous post about a similar topic approaches a solution but I need
help with the regular expression to pass to the m function.

Here's an example of a string:
net user cknotts somepassword /add /active:yes /expires:never
/comment:"Some Comment" /fullname:"Cindy Knottsagain"

The code would look something like this, except the regex in the m{}
function needs work:

while (my $line = <F>)
{
     if( my( $UserName, $passwd, $Comment, $FullName ) = ( $line =~
m{^\s*net\+user\s+(\S+)\s+(\S+)\s*} ) )
     {
          print $UserName, $passwd, $Comment, $FullName;
     }

}
Thanks,

--
Ed

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to