Array problem

2008-06-30 Thread Beyza
Hi, I would like to know how to insert escape character in front of special characters in an array. I have an array which has strings like; John's House Bla bla; etc, When I use them in an SQL query, perl gives an error. So, I need to put escape character for every special character. Is there a

array problem

2010-11-15 Thread shawn wilson
so, i'm thinking i'm not understanding references here again, but here's what i have. i fill in my array here: my $worksheetin = $workbookin->worksheet(0); my ( $row_min, $row_max ) = $worksheetin->row_range(); my ( $col_min, $col_max ) = $worksheetin->col_range(); for my $row ( $row_min .. $row

Array problem

2006-01-22 Thread Andrej Kastrin
I wrote simple script, which have to concatenate multiple lines into array and then print each element of tihis array: open INPUT,"<$ARGV[0]"; while ($line=){ push (@array,$line); foreach $i(@array){ print $i; } } Input is e.g. line 1 line 2 I don't know where is the problem, Pl

Re: Array Problem

2002-01-16 Thread Leon
- Original Message - From: "maureen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> > Currently, the array seems to only be picking up the last name listed in > the text file. > @indata = ; > close(FILE); > foreach $i (@indata) > { > #remove hard return character from each record > chomp($i

Re: Array Problem

2002-01-21 Thread maureen
Thanks so much for your help on this. I tried this suggestion, but unfortunately, the array @indata does not seem to contain the usernames from the file pwdata.txt. I've been looking at this for hours. I hope someone can help me figure out what I am missing here. The objectives for this code and

Re: Array Problem

2002-01-21 Thread Leon
- Original Message - From: "maureen" <[EMAIL PROTECTED]> To: "Leon" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 8:39 AM Subject: Re: Array Problem > if ($username ne /$in{username}/) > { Anything in between the

Re: Array problem

2008-06-30 Thread Aruna Goke
Beyza wrote: Hi, I would like to know how to insert escape character in front of special characters in an array. I have an array which has strings like; John's House Bla bla; etc, When I use them in an SQL query, perl gives an error. So, I need to put escape character for every special charac

Re: Array problem

2008-06-30 Thread Rob Dixon
Beyza wrote: > Hi, > > I would like to know how to insert escape character in front of > special characters in an array. > > I have an array which has strings like; > > John's House > Bla bla; > etc, > > When I use them in an SQL query, perl gives an error. So, I need to > put escape character

Re: Array problem

2008-06-30 Thread Gunnar Hjalmarsson
Beyza wrote: I have an array which has strings like; John's House Bla bla; etc, When I use them in an SQL query, perl gives an error. So, I need to put escape character for every special character. Is there any quick way to do it? perldoc -f quotemeta -- Gunnar Hjalmarsson Email: http://

Re: Array problem

2008-07-01 Thread Amit Saxena
use $*dbh*->*quote*($str) On Tue, Jul 1, 2008 at 4:59 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Beyza wrote: > >> I have an array which has strings like; >> >> John's House >> Bla bla; >> etc, >> >> When I use them in an SQL query, perl gives an error. So, I need to >> put escape chara

Re: Array problem

2008-07-02 Thread Beyza
Thanks for the answers. I have tried to use quotemeta but it did not work as expected, DBI's quote function was exactly what I want. Thanks again, On Jul 1, 6:35 pm, [EMAIL PROTECTED] (Amit Saxena) wrote: > use > > $*dbh*->*quote*($str) > > On Tue, Jul 1, 2008 at 4:59 AM, Gunnar Hjalmarsson <[EM

Re: array problem

2010-11-15 Thread shawn wilson
too much freaking data. i increased my scroll buffer and found that i do get data, just not the last 1k lines err On Mon, Nov 15, 2010 at 12:33 PM, shawn wilson wrote: > so, i'm thinking i'm not understanding references here again, but here's > what i have. > > i fill in my array here: >

Re: array problem

2010-11-15 Thread Uri Guttman
> "sw" == shawn wilson writes: sw>my $worksheetout = $workbookout->add_worksheet( '$year' ); why are you quoting $year? that doesn't do what you think it does. in fact it is a bug. you aren't checking if you get results out of that call which is another problem. uri -- Uri Guttman

Re: array problem

2010-11-15 Thread shawn wilson
On Mon, Nov 15, 2010 at 1:54 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > sw>my $worksheetout = $workbookout->add_worksheet( '$year' ); > > why are you quoting $year? that doesn't do what you think it does. in > fact it is a bug. you aren't checking if you get results out

RE: Array problem

2006-01-22 Thread Thomas Bätzler
Andrej Kastrin <[EMAIL PROTECTED]> asked: > I wrote simple script, which have to concatenate multiple > lines into array and then print each element of tihis array: > > open INPUT,"<$ARGV[0]"; > while ($line=){ I would instead suggest you use the <> special filehandle. This automagically opens a

Re: Array problem

2006-01-22 Thread Mazhar
Mr Andrej, I think the following code will work for u, open INPUT,"<$ARGV[0]"; while (){ @array=$_; } foreach $i(@array){ print $i; } Regards Mazhar On 1/23/06, Thomas Bätzler <[EMAIL PROTECTED]> wrote: > > Andrej Kastrin <[EMAIL PROTECTED]> asked: > > I wrote simple script, which have

Re: Array problem

2006-01-22 Thread John Doe
Andrej Kastrin am Montag, 23. Januar 2006 07.55: > I wrote simple script, which have to concatenate multiple lines into > array and then print each element of tihis array: > > I don't know where is the problem, Please, help! The basic problem is that you try to print the result within the (while)

Re: Array problem

2006-01-23 Thread Ditlev, Unix Consulting
Is this what you wan't ? > open INPUT,"<$ARGV[0]"; > while ($line=){ >push (@array,$line); > } >foreach $i(@array){ >print $i; > } "Andrej Kastrin" <[EMAIL PROTECTED]> skrev i en meddelelse news:[EMAIL PROTECTED] >I wrote simple script, which have to concatenate multiple lines

Array problem, I think

2002-11-11 Thread Cacialli, Doug
Y'all, I'm new to programming in perl, and relatively new to programming at all, so I apologize if this is a little hard to follow. I've got oodles of data. It looks like this: 0 @F1@ FAM 1 HUSB @I13@ 1 WIFE @I14@ 1 CHIL @I8@ 0 @F2@ FAM 1 HUSB @I10@ 1 WIFE @I8@ 1 CHIL @I11@ 1 CHIL @I12@ etc. T

Two Dimensional Array Problem

2005-06-03 Thread ahuber
I am trying to send the output of a mysql query to a two dimensional array. This is what I've tried using push. while (@results = $sth->fetchrow_array ()) { $x = $results[0]; $y = $results[1]; push (@data,[$x],[$y]); } However, I don't get back a two dimensional array, I get back a s

Re: Array problem, I think

2002-11-11 Thread Cacialli, Doug
One additional thing: The data exists in an array, where each line of raw data is a scalar string within the array. -Original Message- From: Cacialli, Doug Sent: Monday, November 11, 2002 6:18 PM To: '[EMAIL PROTECTED]' Subject: Array problem, I think Y'all, I'm n

Re: Array problem, I think

2002-11-11 Thread Jason Tiller
Hi, Doug, :) On Mon, 11 Nov 2002, Cacialli, Doug wrote: > I'm new to programming in perl, and relatively new to programming at > all, so I apologize if this is a little hard to follow. Wasn't hard at all! You described the problem very succinctly. > I've got oodles of data. It looks like this

Re: Array problem, I think

2002-11-11 Thread Wiggins d'Anconia
This solution works well and is clean, if you are curious about some of the *magic* he is performing in his foreach I would suggest reading up on the special variable $_ for those of us experienced in perl it isn't as daunting to just throw a foreach (@array) in the code and know that it is goi

Re: Array problem, I think

2002-11-11 Thread Jason Tiller
Hi, Wiggins, :) On Mon, 11 Nov 2002, Wiggins d'Anconia wrote: > This solution works well and is clean, if you are curious about some > of the *magic* he is performing in his foreach I would suggest > reading up on the special variable $_ for those of us experienced in > perl it isn't as daunting

Re: Array problem, I think

2002-11-11 Thread Wiggins d'Anconia
No need to apologize. Agreed. http://danconia.org Jason Tiller wrote: Hi, Wiggins, :) On Mon, 11 Nov 2002, Wiggins d'Anconia wrote: This solution works well and is clean, if you are curious about some of the *magic* he is performing in his foreach I would suggest reading up on the special v

Re: Array problem, I think

2002-11-16 Thread badchoice
> 0 @F1@ FAM > 1 HUSB @I13@ > 1 WIFE @I14@ > 1 CHIL @I8@ > 0 @F2@ FAM > 1 HUSB @I10@ > 1 WIFE @I8@ > 1 CHIL @I11@ > 1 CHIL @I12@ > etc. $/ = undef; for (split /\n0/, <>) { ($key) = /\@(..)/; $hash{$key} = [ /\@(\w+)\@$/gm ]; } > $individuals{"F1"}[0] = "I13"; > $individuals{"F1"

Re: Array problem, I think

2002-11-16 Thread Paul Johnson
On Mon, Nov 11, 2002 at 06:17:58PM -0500, Cacialli, Doug wrote: > I've got oodles of data. It looks like this: > > 0 @F1@ FAM > 1 HUSB @I13@ > 1 WIFE @I14@ > 1 CHIL @I8@ > 0 @F2@ FAM > 1 HUSB @I10@ > 1 WIFE @I8@ > 1 CHIL @I11@ > 1 CHIL @I12@ > etc. [ snip problem ] > I'm familiar with substr,

Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
Hi groups, I have a file which contain many many of this line (Fasta Format): YNL331C CAATATGCGAGGGACCTACATGTTGA CATGACAATGAATTCTATTGAA YKL071W ATAATTATTCCTGTTTCTTTAACCTG GTGTACAAACACTTAAGC What I would like to do is to concatenate the line below > into one single string. Such as the

RE: Two Dimensional Array Problem

2005-06-03 Thread brian . barto
day, June 03, 2005 2:42 PM To: beginners@perl.org Subject: Two Dimensional Array Problem I am trying to send the output of a mysql query to a two dimensional array. This is what I've tried using push. while (@results = $sth->fetchrow_array ()) { $x = $results[0]; $y = $results[1]

RE: Two Dimensional Array Problem

2005-06-03 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > I am trying to send the output of a mysql query to a two dimensional > array. > > This is what I've tried using push. > > while (@results = $sth->fetchrow_array ()) > { > $x = $results[0]; > $y = $results[1]; > push (@data,[$x],[$y]); push( @data,

Re: Two Dimensional Array Problem

2005-06-03 Thread Wiggins d'Anconia
[EMAIL PROTECTED] wrote: > I am trying to send the output of a mysql query to a two dimensional array. > > This is what I've tried using push. > > while (@results = $sth->fetchrow_array ()) > { > $x = $results[0]; > $y = $results[1]; > push (@data,[$x],[$y]); > } > > However, I don't

RE: Two Dimensional Array Problem

2005-06-03 Thread brian . barto
ubject: RE: Two Dimensional Array Problem [EMAIL PROTECTED] wrote: > I am trying to send the output of a mysql query to a two dimensional > array. > > This is what I've tried using push. > > while (@results = $sth->fetchrow_array ()) > { > $x = $results[0];

RE: Two Dimensional Array Problem

2005-06-03 Thread Wagner, David --- Senior Programmer Analyst --- WGO
]; beginners@perl.org > Subject: RE: Two Dimensional Array Problem > > > [EMAIL PROTECTED] wrote: >> I am trying to send the output of a mysql query to a two dimensional >> array. >> >> This is what I've tried using push. >> >> while (@results = $sth-

Re: Two Dimensional Array Problem

2005-06-03 Thread Chris Charley
[snip] Hi Brian, I usually deal with multidimensional arrays this way: $i = 0; while (@results = $sth->fetchrow_array ()) { $x = $results[0]; $y = $results[1]; @points = ($x, $y); $data[$i] = [EMAIL PROTECTED]; $i++; } Just a note about a possible problem with the statement:

Re: Two Dimensional Array Problem

2005-06-05 Thread Wiggins d'Anconia
Always group reply so others can help and be helped, and to avoid getting accidentally ignored. "Because it's up-side down. Why is that? It makes replies harder to read. Why not? Please don't top-post." - Sherm Pendley, Mac OS X list Aaron Huber wrote: > > On 6/3/05, Wiggins d'Anconia <[EMAIL PR

RE: Concatenating line into array problem

2004-06-10 Thread Tim Johnson
: [EMAIL PROTECTED] Subject: Concatenating line into array problem What I would like to do is to concatenate the line below > into one single string. Such as the output would be: CAATATGCGAGGGACCTACATGTTGAGCATGACAATGAATTCTATTGA ATAATTATTCCTGTTTCTTTAACCTGGTGTACAAACACTT

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
On Thu, 10 Jun 2004 21:19:17 -0700, Tim Johnson <[EMAIL PROTECTED]> wrote: while (<>) { if (/^>/) { push (@crseq, $line); next; } chomp; $line .= $_; } shift @crseq; print join("\n", @crseq), "\n"; #

RE: Concatenating line into array problem

2004-06-10 Thread Charles K. Clarkson
From: Edward Wijaya wrote: : #---My Code -- : while (<>) { : if (/^>/) { : next; : } : chomp; : $line .= $_; : } : push (@crseq, $line); : print join("\n", @crseq), "\n"; How about: my @crseq; while ( <> ) { next unless

Re: Concatenating line into array problem

2004-06-10 Thread Edward Wijaya
How about: my @crseq; while ( <> ) { next unless/^[ACGT]/; chomp; push @crseq, $_ . scalar <>; } print @crseq; Hi Charles, Thanks for your reply. Your code works for my example in email, but not the file with more lines, (please see attached file). So sorry if I didn't give precise

RE: Concatenating line into array problem

2004-06-10 Thread Charles K. Clarkson
From: Edward Wijaya wrote: :: How about: :: :: my @crseq; :: while ( <> ) { :: next unless/^[ACGT]/; :: chomp; :: push @crseq, $_ . scalar <>; :: } :: print @crseq; :: : : Hi Charles, : : Thanks for your reply. : : Your code works for my example in e

Re: Concatenating line into array problem

2004-06-11 Thread John W. Krahn
Edward Wijaya wrote: > > Hi groups, Hello, > I have a file which contain many many of this line (Fasta Format): > > > YNL331C > CAATATGCGAGGGACCTACATGTTGA > CATGACAATGAATTCTATTGAA > > > YKL071W > ATAATTATTCCTGTTTCTTTAACCTG > GTGTACAAACACTTAAGC > > What I would like to do is to con

Re: Concatenating line into array problem

2004-06-11 Thread John W. Krahn
"John W. Krahn" wrote: > > This should do what you want: > > $/ = '>'; > while ( <> ) { > next unless s/\s+\S.*//; > chomp; > tr/\n//d; > print "$_\n"; > } After seeing your data file change that to: $/ = '>'; while ( <> ) { next unless s/\S+.*\n//; chomp; tr/\n/

Re: Concatenating line into array problem

2004-06-11 Thread Zeus Odin
This works: ---BEGIN CODE--- #!/usr/bin/perl use warnings; use strict; $/ = '>'; while () { s/(.*?\n.*?)\n/$1/s; print; } __DATA__ > YNL331C CAATATGCGAGGGACCTACATGTTGA CATGACAATGAATTCTATTGAA > YKL071W ATAATTATTCCTGTTTCTTTAACCTG GTGTACAAACACTTAAGC ---END CODE---