bt707
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-CT 0077,OU=GB ,OU=EAF,DC =HHH,DC=ab c,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,
#! /usr/bin/perl
use warnings;
$ad=q{CN=John Doe 159657,OU=Users,OU=City-CT
$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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,