Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

Perl error with join

I need to set a variable but from the snip I have below I get what I want but also a warning.

#! /usr/bin/perl
use warnings;

$ad=q{CN=John Doe  159657,OU=Users,OU=City-CT0077,OU=GB,OU=EAF,DC=HHH,DC=abc,DC=com};

$krb = join(q{.},$ad=~ m/dc *= *([a-z]+)/ig),qq{\n};
$krb = lc("$krb");
print "$krb\n";

This will print out what I want but with a warning:

Useless use of a constant in void context at ./krb.pl line 6.
hhh.abc.com

I can do a print such as this with no warning:
print lc join(q{.},$ad=~ m/dc *= *([a-z]+)/ig),qq{\n};

What do I need to change when not just printing this and putting what I need in a variable like above?

Thanks,

ASKER CERTIFIED SOLUTION
Avatar of pwust
pwust
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

I had thought the newline was the problem and tried that but still got the same error, but must of not done it right, it worked now with you line.

Thanks,