Seyi Ogunbona wrote:
>
> Hi,
Hello
> Two things.
> Firstly, I would like to know if it is possible to
> write in a program or script in perl to read a set of
> two numbers seperated by a comma, I have exported to
> a text file and the put
> the numbers in another table as arguements.
Yes, it is possible and perl provides a function specifically for this
purpose - split().
while ( <SOMETHING> ) {
my ( $one, $two ) = split /,/;
Another way to do it is to use a regular expression.
while ( <SOMETHING> ) {
my ( $one, $two ) = /(\d+)\D+(\d+)/;
> Secondly, can you give me directions if yes to above,
> I have written a script that will take the numbers,
> and put then in another text file but I am stuck with
> geting perl to treat them as variables
> for the next text file. shown below
Sorry, I don't understand what you mean by "treat them as variables for
the next text file." and your example below doesn't help much either.
> #! usr/bin/perl -w
>
> open(PRE, "d:\mac.txt") || die " cannot open
> mac.txt for reading: $!";
> open(POST, ">info.txt") || die " cannot create
> info_sbu.txt: $!";
>
> while (<PRE>) {# read a line from mac.txt into $_
>
> print POST $_; # print that line to info.txt
> }
>
> #Close(PRE) || die "can't close mac.txt: $!" ;
>
> #close(POST) || die "can't close info_sbu.txt: $!" ;
> any suggestions or nudge in the right direction is
> greatly appreciated
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]