I do realize that there are a lot of perl regex questions here on SO; I haven't been able to find one that helps me in my situation. I have the following string:
string = "dn: example\nl: example\ndepartment: example\nname: example"
I am trying to extract each field (except dn) using the following:
my ($name) = $output_string =~ /name:\s(\w+)\n/;
my ($department) = $output_string =~ /department:\s(\w+)\n/;
my ($location) = $output_string =~ /location:\s(\w+)\n/;
I must not be understanding how to use regex, because that isn't working for me. Each variable is ending up undefined. What am I doing wrong?