Re: [MacPerl-WebCGI] well split!!!
[email protected] (Shelly Spearing) Tue, 6 Mar 2001 17:31:23 -0700
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <p05010401b6cb31282c12@[128.165.131.177]> |
Why not: ($dbID, $cat, $varName, $price, $desc, $itemNum) = split(/\t/); Then you can manipulate at will, variable by variable and print individually or grouped/reordered. --Shelly At 7:03 PM -0500 3/6/01, [email protected] wrote: >>Try it this way: >> >> while (<DATA>) { >> @line = split /\t/; # $_ is implied >> # ... >> >> - Bruce > >- Bruce : > >Okay, I tried it. But, the following code is what I had to do to >fill, and print, all the variables I wanted from a multi-record >database: > > open(DATA,$datafile) || &open_error($datafile); > while (<DATA>) > { > for (split(/\t/)) > { > @line = split (/\t/); # $_ is implied > > $database_id = $line[0]; > $category = $line[1]; > $variable_name = $line[2]; > $price = $line[3]; > $description = $line[4]; > $item_number = $line[5]; > } > } > >Now, is there a simpler way to do this? -- ----------------------------------------------------------- Shelly Spearing Systems Engineer Advanced Accelerator Applications Project Office [email protected], MS H816, 505-665-0587 FAX: 505-667-7443