Hey Jerry,
I have a one quick solution for you.
str = "\"q4171\",\"(08/11/03 23:30:48)\",\"\"";
@array = split(/,/,$str);
foreach (@array)
{
s/\"//g ;
}
HTH
Pinku
Jerry Preston wrote:
Hi!,
I am trying to breakdown this line:
"q4171","(08/11/03 23:30:48)",""
with ( @data ) = split /[,|\"]/
hi Jerry,
On second thought, I have a better solution for you.
$str = "\"q4171\",\"(08/11/03 23:30:48)\",\"\"";
@array = $str =~ /"([^"]*)"/g;
HTH
Pinku
Jerry Preston wrote:
Hi!,
I am trying to breakdown this line:
"q4171","(08/11/03 23:30:48)",""
with ( @data ) = split /[,|\"]/;#"
but I ge
"q4171","(08/11/03 23:30:48)",""
Makes me thing of CSV (comma separated value).
You may need to check CPAN for CSV module if
You have to parse a lot of such string from a given file.
José.
-Original Message-
From: Jerry Preston [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 10:
On Aug 12, Jerry Preston said:
>I am trying to breakdown this line:
>
>"q4171","(08/11/03 23:30:48)",""
>
>with ( @data ) = split /[,|\"]/;#"
Either use the Text::CSV module from CPAN (or perhaps Text::CSV_XS), or
else use a regex like the following:
@fields = $str =~ m{ " [^"]* " | [^,]+ }xg
Jerry Preston wrote:
>
> Hi!
Hello,
> I am looking for way to reduce the following code, a better way, a perl
> way. Any ideas?
>
> while ( my ( $Site, $Description, $Part_Number, $Part_Serial_Number, $Qty,
> $RMA_Number, $Customer_Contac, $RMA_Date, $Part_Rec ) = $sth->fetchrow()) {
> # w
Look at the sprintf function. Please!
> # while ( $data ) = $sth->fetchrow()) {
> $l = length( $Site );
> if( $l != 5 ) {
> $s = substr( "", 0, 5 - $l );
> $Site .= $s;
> }
Does this do what you want?
$Site = sprintf '%-5s', $Site;
One liner:
C:\>perl -e"$S
Hi Jerry.
"Jerry Preston" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi!
>
> I am looking for way to reduce the following code, a better way, a
perl
> way. Any ideas?
I think you've been overlooked a little because your post looks
very much like a 'please do my work for me' p