in reply to Re: pattern matching question
in thread pattern matching question
Hello Everyone, Thank you for your help. I think I found a solution. It may not be as pretty as the ones supplied (I am still researching what those special characters mean) but I think it will work. If anyone see's a flaw in this code, please let me know as I will be implementing into my production environment very soon. Thanks, Jaime
#my $hostname = 'name.ms.com';
my $hostname = 'name';
print $hostname;
if ($hostname =~ /\.ms.com$/) {
print "\nthis is true";
@nameparts = split(/\./,$hostname);
print "\n";
print $nameparts[0];
print "\n";
print $nameparts1;
print "\n";
print $nameparts2;
$firstpart = $nameparts[0];
print "\n";
print $firstpart;
}
else {
print "\nthis is false";
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: pattern matching question
by kennethk (Abbot) on Jul 20, 2011 at 20:46 UTC |