develooper Front page | perl.beginners | Postings from April 2002

Re: Creating variables of a string

Thread Previous | Thread Next
From:
John W. Krahn
Date:
April 2, 2002 11:11
Subject:
Re: Creating variables of a string
Message ID:
3CAA0219.4D549ADE@acm.org
[Please don't top-post]


Michael Stearman wrote:
> 
> 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*$/;

my ($target, $count, $num) = split ' ', $word;


> print "Target = $target \n";
> print "Count = $count \n";


John
-- 
use Perl;
program
fulfillment

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About