> -----Original Message----- > From: Michael Stearman [mailto:qazwsxe7@hotmail.com] > Subject: Re: Creating variables of a string > > Right now it is not working and I was wondering if I sent the > code maybe > someone with more experience with this will see the problem. > I am very new > to this. The line I am trying to create the variables from is > > C6xxxSimulator(TI) 61 1 > > and the code is > > $word = <DATA>; #Assign the next line to the $word variable > chomp $word; > print "$word\n"; > my ($target, $count, $num) = $word = ~ > /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; > print "Target = $target \n"; > print "Count = $count \n"; > > and the output is > > C6xxxSimulator(TI) 61 1 > Target = 4294967295 > Count = > > Does anyone have any ideas? I'm lost. I agree with Japhy that a split is probably the best solution, but to answer your question, you have a space between '=' and '~', which is causing the pattern match to not bind to the $word variable. my ($target, $count, $num) = $word = ~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; should be my ($target, $count, $num) = $word =~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; Hope this helps... Jason CONFIDENTIALITY NOTICE: ************************************************************************ The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited. ************************************************************************Thread Previous | Thread Next