Re: split function

2011-12-15 Thread Shlomi Fish
Hi Chris, On Thu, 15 Dec 2011 11:58:00 -0600 Chris Stinemetz wrote: > On Thu, Dec 15, 2011 at 10:42 AM, Dr.Ruud wrote: > > On 2011-12-14 05:43, Chris Stinemetz wrote: > > > >> I am trying to split the first element of an array by white space then > >> continue reading the rest of the file. > >>

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Is that your company's policy, or do you just lack root access? If it's the > latter, then see the various resources at http://perl-begin.org/topics/cpan/ , > so you can see how to install Perl modules from CPAN under your home > directory. > It isn't a company policy just circumstance. The u

Re: split function

2011-12-16 Thread Shlomi Fish
Hi Chris, On Thu, 15 Dec 2011 15:29:08 -0600 Chris Stinemetz wrote: > > > > Is that your company's policy, or do you just lack root access? If it's the > > latter, then see the various resources at > > http://perl-begin.org/topics/cpan/ , > > so you can see how to install Perl modules from CPAN

Re: split function

2011-12-16 Thread shawn wilson
On Thursday, December 15, 2011, Chris Stinemetz wrote: > > It isn't a company policy just circumstance. The unix box I'm using > doesn't support DNS nameserver lookup or a C compiler. > > I'm currently using Perl 5.6.1 which doesnt' support local::lib and I > can't install perlbrew to upgrade my

Re: split function

2011-12-16 Thread thebarn...@gmail.com
split() splits on whitespace by default. so the "\s+/" is optional. $_ = "3 element array"; @words = split; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: split function

2011-12-16 Thread Chris Stinemetz
> > However I think it's more likely that you need /all/ of the data to be > output, so I suggest something like my program below. > > HTH, > > Rob > > > use strict; > use warnings; > > my @headers; > > while () { >  if (@headers) { >    my @data = split; >    for my $i (0 .. $#headers) { >      pr

Re: split function

2011-12-17 Thread Brandon McCaig
On Fri, Dec 16, 2011 at 09:36:53PM -0600, Chris Stinemetz wrote: > This program does all I need it to do. I am having some difficulty > wrapping my head around it though. Mainly the for loop. Did Rob use > special varible? > > If any one can explain it to me so I can have a better understanding >

Re: split regex

2015-03-19 Thread Danny Wong (dannwong)
Nevermind. I used regex to accomplish what I wanted instead of the split command. Thanks guys! From: Danny H Wong mailto:dannw...@cisco.com>> Date: Thursday, March 19, 2015 at 2:25 PM To: Perl List mailto:beginners@perl.org>>, Perl Beginners mailto:beginners@perl.org>> Subject: split regex Hi P

Re: split regex

2015-03-20 Thread Shlomi Fish
Hi Danny, On Thu, 19 Mar 2015 21:42:53 + "Danny Wong (dannwong)" wrote: > Nevermind. I used regex to accomplish what I wanted instead of the split > command. Thanks guys! > Just a note in general: sometimes when a simple split or a regex match fails you may opt to employ more complex pars

Re: split regex

2015-03-21 Thread Brandon McCaig
Danny Wong: Hello, On Thu, Mar 19, 2015 at 09:25:02PM +, Danny Wong (dannwong) wrote: > Hi Perl GURU, I have a string like this: > > 'Baseline: (_bMgvUBQ_EeKsP6DECdq0Lg) 1 "Initial Baseline" > "Initial Baseline of Component NGP-Diagnostics" Sivakumar Subas > Oct 12, 2012 12:35:41 AM'; > > I

Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 13.00: > Hi List, Hi Umesh > I want to get that value of *-i* set in below line. > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m* > > What is the best way to get the value of *-i* values into one array. For > ex: I want the output

Re: split regex

2005-12-15 Thread Umesh T G
Hi John, I tried like this, where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m'* if (grep/^Options/,$line) { @inc=split(/-i/,$line); foreach $word (@inc) { print "$word\n"; } I do not know how to proceed after this. Thanks for your quick reply... Thank

Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 14.20: > Hi John, Hi Umesh > I tried like this, where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2" > -k -p -i"dir3\dir4" -m'* > > > > if (grep/^Options/,$line) > { > > @inc=split(/-i/,$line); > > foreach $word (@inc) > { > print "$word\n"; > } > >

Re: split regex

2005-12-15 Thread Umesh T G
Hi Joe, just to correct my prevoius one, my $line does not have * in the begining, that was a type. the $line value is like this *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m* my grep return the values correct to my array and the values in array will be like this obviously:

Re: split regex

2005-12-15 Thread Shawn Corey
Umesh T G wrote: I tried like this, where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m'* This line won't compile. Which of the following is it? $line='Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m'; $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir

Re: split regex

2005-12-15 Thread Shawn Corey
Umesh T G wrote: Hi Joe, just to correct my prevoius one, my $line does not have * in the begining, that was a type. the $line value is like this *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m* my grep return the values correct to my array and the values in array will be l

Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 15.31: > Hi Joe, > > just to correct my prevoius one, my $line does not have * in the begining, > that was a type. the $line value is like this > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m* > > > > my grep return the values correct

Re: split regex

2005-12-15 Thread Umesh T G
Thanks Very much John. :) it worked, but a small problem. if I have "\" after the directory name, it does not take as new instanance. for ex: if my $line is*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4\" -m -n -i"\dir5\dir6" -k* ** then, I'm getting output like this, dir1\dir

Re: split regex

2005-12-15 Thread Umesh T G
Sorry for that John. It works fine. Many thanks for your help. Umesh On 12/16/05, Umesh T G <[EMAIL PROTECTED]> wrote: > > Thanks Very much John. :) it worked, but a small problem. if I have > "\" after the directory name, it does not take as new instanance. > for ex: > if my $line is*

Re: split on "."

2006-04-07 Thread HObbES
Hi Brent, The split() is wonderful for doing what you want. -Anne This one time, Brent Clark wrote: > Hi all > > I have a string like so > > 01.01.04 > > I need to split and add it to an array > > my method of > > ($abc) = $test =~ /\./g; > > does not seem to provide me with a satisfying

Re: split on "."

2006-04-07 Thread Tom Phoenix
On 4/7/06, Brent Clark <[EMAIL PROTECTED]> wrote: > I have a string like so > > 01.01.04 > > I need to split and add it to an array Split, huh? Have you tried using the split() operator? It's covered in the perlfunc manpage. But if you're dealing with date-and-time data, you may really be lookin

Re: split on "."

2006-04-07 Thread Mr. Shawn H. Corey
On Fri, 2006-07-04 at 17:38 +0200, Brent Clark wrote: > Hi all > > I have a string like so > > 01.01.04 > > I need to split and add it to an array > > my method of > > ($abc) = $test =~ /\./g; > > does not seem to provide me with a satisfying result > > and I get back is the period. > > If

Re: Split function

2006-04-16 Thread Wijaya Edward
> Hi, > > To run/use Split function in the perl script , is it necessary to > include/add any perl module ? No no need. It is a built in function. perldoc -f split -- Regards, Edward WIJAYAA Institute For Infocomm Research - Disclaimer - This email is confidenti

Re: split doubt

2006-05-25 Thread Chris Charley
- Original Message - From: ""Saurabh Singhvi"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "Perl FAq" Sent: Thursday, May 25, 2006 3:38 PM Subject: split doubt Hi the format of split() defines that one can split a string into a fixed number of specifies strings. for eg ($lo

Re: split doubt

2006-05-25 Thread Joshua Colson
On Thu, 2006-05-25 at 19:38 +, Saurabh Singhvi wrote: > Hi > > the format of split() defines that one > can split a string into a fixed number > of specifies strings. for eg > > ($login, $passwd, $remainder) = split(/:/, $_, 3); > > Now, the thing is, it splits on first 3 parts. > Can i do t

Re: split doubt

2006-05-25 Thread Mr. Shawn H. Corey
On Thu, 2006-25-05 at 13:17 -0700, Joshua Colson wrote: > On Thu, 2006-05-25 at 19:38 +, Saurabh Singhvi wrote: > > Hi > > > > the format of split() defines that one > > can split a string into a fixed number > > of specifies strings. for eg > > > > ($login, $passwd, $remainder) = split(/:/,

Re: split doubt

2006-05-25 Thread John W. Krahn
Saurabh Singhvi wrote: > Hi Hello, > the format of split() defines that one > can split a string into a fixed number > of specifies strings. for eg > > ($login, $passwd, $remainder) = split(/:/, $_, 3); > > Now, the thing is, it splits on first 3 parts. > Can i do the reverse?? as in instead of

Re: split function

2006-07-19 Thread Xavier Noria
On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote: I need to split following string cs_backup_restore_cmvobsvr1mum the output which i am looking for is cs_backup_restore and _cmvobsvr1mum Which is the criteria, everything up to the last underscore? -- fxn -- To unsubscribe, e-mail

RE: split function

2006-07-19 Thread Sayed, Irfan \(Irfan\)
-Original Message- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 19, 2006 1:33 PM To: Perl Beginners Subject: Re: split function On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote: > I need to split following string > > cs_backup_restore_cmvobsvr1mu

Re: split function

2006-07-19 Thread Xavier Noria
On Jul 19, 2006, at 10:05, Sayed, Irfan ((Irfan)) wrote: I think criteria shud be _ but I need output in following manner That criteria is ambiguous becasue there are several _s and you need to deal with them differently, that is, ignoring some and splitting on some. Can you be more specif

RE: split function

2006-07-19 Thread Nagrale, Ajay
x27;cs_backup_restore_cmvobsvr1mum'; my @arr= ($str=~/(.+)_(.+)/); print join "\n",@arr,"\n";' cs_backup_restore cmvobsvr1mum Ajay> Thanks, Ajay -Original Message- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 19, 2006 1:33 PM To: Perl Begi

Re: split function

2006-07-19 Thread Dr.Ruud
"Sayed, Irfan (Irfan)" schreef: > I need to split following string > > cs_backup_restore_cmvobsvr1mum > > the output which i am looking for is > > cs_backup_restore and _cmvobsvr1mum $ perl -Mstrict -wle ' $_ = "cs_backup_restore_cmvobsvr1mum" ; @_ = split /(_)/ ; # print for @_ ; $" = "\t"

Re: split function

2006-07-19 Thread Mumia W.
On 07/19/2006 02:57 AM, Sayed, Irfan (Irfan) wrote: Hi, I need to split following string cs_backup_restore_cmvobsvr1mum the output which i am looking for is cs_backup_restore and _cmvobsvr1mum can anybody plz help regards irfan. Sayed, Irfan; your questions are too basic. Any

Re: split function

2006-07-19 Thread Prasad
econd: _cmvobsvr1mum Regards, Prasad ""Sayed, Irfan (Irfan)"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] .. -Original Message- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 19, 2006 1:33 PM To: Perl Beginners Subject: Re: split fu

RE: split error

2002-12-28 Thread Wagner, David --- Senior Programmer Analyst --- WGO
It may have something to do with what shell you are running under. I ran it under a korn shell(MKS) w2k and id one at 1590 characters and had no problem. From some other emails I have seen, the shell may allow only so much to happen. What are you running under? Wags ;) -Orig

Re: split error

2002-12-28 Thread Rob Dixon
Hi Shawn I'll stick my neck out and say that this is a bug in Perl, to do with Unicode support. Running the loop from 0..256 gives you 256 8-bit characters and one 16-bit character (0x0100 = 256). This seems to upset split() as it stands. Try adding: use bytes; at the start of your code, and

Re: split error

2002-12-28 Thread Wiggins d'Anconia
The original posted perl line worked fine on my RH8.0 box. ~$ perl -e 'for(0..256) { $s.=chr($_) } for(split(//,$s)) { print }' 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øù

Re: split error

2002-12-28 Thread Shawn B
Thanks for the reponses, See below: - Original Message - From: "Wiggins d'Anconia" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, December 28, 2002 3:28 PM Subject: Re: split error > The original posted perl line worked fine on my RH8.0 b

Re: split error

2002-12-28 Thread Shawn B
[snip] > On FreeBSD, I get: > > % perl -e 'use bytes; for(0..256) { $s.=chr($_) } for(split(//,$s)) { print }' > > > > >!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ > >¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍ

Re: Split question

2003-12-13 Thread John W. Krahn
Perl wrote: > > Hi, Hello, >i am new to Perl. >here is my question > > i have a character string like abc#def#ghi#jkl > > i want to split the string based on the delimiter # so that i get > something like this : > > abc def ghi jkl > > But > > @temp = split(/#/, "ab

Re: Split question

2003-12-13 Thread Kenton Brede
On Sat, Dec 13, 2003 at 09:16:35PM -0800, Perl wrote: > Hi, >i am new to Perl. >here is my question > > i have a character string like abc#def#ghi#jkl > > i want to split the string based on the delimiter # so that i get > something like this : > > abc def ghi jkl > > Bu

Re: Split question

2003-12-14 Thread Josimar Nunes de Oliveira
Try this: @temp = split('\#', "abc#def#ghi#jkl") ; foreach (@temp){ print "\n", $_; } Josimar - Original Message - From: "Perl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, December 14, 2003 3:16 AM Subject: Split question > Hi, >i am new to Perl. >here is my que

Re: Split question

2003-12-14 Thread John W. Krahn
Josimar Nunes De Oliveira wrote: > > From: "Perl" <[EMAIL PROTECTED]> > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > doesn't seem to work. > > > > am i doing anything wrong here ? > > Try this: > > @temp = split('\#', "abc#def#ghi#jkl") ; > foreach (@temp){ > print "\n", $_; > } The

Re: Split question

2003-12-14 Thread Joel Newkirk
On Sun, 2003-12-14 at 14:52, John W. Krahn wrote: > Josimar Nunes De Oliveira wrote: > > > > From: "Perl" <[EMAIL PROTECTED]> > > > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > > > doesn't seem to work. > > > > > > am i doing anything wrong here ? > > > > Try this: > > > > @temp = spl

Re: Split question

2003-12-14 Thread R. Joseph Newton
Joel Newkirk wrote: > > The first argument to split is converted to a regular expression and the > > '#' character is not special in a regular expression so split/#/ and > > split'\#' do exactly the same thing. > > Well, actually they don't, since the 'bare' # will be interpreted as > starting a c

Re: Split question

2003-12-14 Thread John W. Krahn
Joel Newkirk wrote: > > On Sun, 2003-12-14 at 14:52, John W. Krahn wrote: > > Josimar Nunes De Oliveira wrote: > > > > > > From: "Perl" <[EMAIL PROTECTED]> > > > > > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > > > @temp = split('\#', "abc#def#ghi#jkl") ; > > > > The first argument to s

Re: Split question

2003-12-14 Thread James Edward Gray II
On Dec 14, 2003, at 6:42 PM, R. Joseph Newton wrote: The only problem I see with John's code is that it addumes that the print statement will print a newline, which it doesn't [at least on my installation of V5.8]. Na, John's smarter than you give him credit for here. Here was the code: On Dec

Re: Split question

2003-12-15 Thread John W. Krahn
"R. Joseph Newton" wrote: > > Joel Newkirk wrote: > > > Well, actually they don't, since the 'bare' # will be interpreted as > > starting a comment, while the one in quotes won't... ;^) > > > > The op's assignment was assigning 'split(/' to @temp... > > Did you test. Did YOU test? > The only

Re: Split question

2003-12-15 Thread Joel Newkirk
On Sun, 2003-12-14 at 18:11, Joel Newkirk wrote: > > > > The first argument to split is converted to a regular expression and the > > '#' character is not special in a regular expression so split/#/ and > > split'\#' do exactly the same thing. > > Well, actually they don't, since the 'bare' # wi

Re: Split question

2003-12-15 Thread R. Joseph Newton
"John W. Krahn" wrote: > "R. Joseph Newton" wrote: > > > > Joel Newkirk wrote: > > > > > Well, actually they don't, since the 'bare' # will be interpreted as > > > starting a comment, while the one in quotes won't... ;^) > > > > > > The op's assignment was assigning 'split(/' to @temp... > > > >

RE: Split question

2003-12-15 Thread Perry, Alan
On Monday, December 15, 2003 03:05, John W. Krahn wrote: >Here is a little quiz for you beginners out there. split() treats its >first argument as a regular expression. There are TWO exceptions where >the first argument does not behave the same as a normal regular >expression. What are they? T

RE: Split question

2003-12-15 Thread Wiggins d Anconia
> On Monday, December 15, 2003 03:05, John W. Krahn wrote: > > >Here is a little quiz for you beginners out there. split() treats its > >first argument as a regular expression. There are TWO exceptions where > >the first argument does not behave the same as a normal regular > >expression. Wha

RE: Split question

2003-12-15 Thread Charles K. Clarkson
Wiggins d Anconia <[EMAIL PROTECTED]> wrote: : : > On Monday, December 15, 2003 03:05, John W. Krahn wrote: : > : > > Here is a little quiz for you *BEGINNERS* out there. [emphasis added] : : But parentheses are normal in a regex, though granted the : return is odd. I would guess as the second

Re: Split question

2003-12-16 Thread Rob Dixon
John wrote: > > Here is a little quiz for you beginners out there. split() treats its > first argument as a regular expression. There are TWO exceptions where > the first argument does not behave the same as a normal regular > expression. What are they? I know! Please sir! Actually this 'backw

Re: Split Problem

2003-03-27 Thread Aim
Hi, Somethig like this should work (untested): my ( $name, $info ) = split /\(/, $data; regards, Aim. [EMAIL PROTECTED] wrote: > I'm having a problem splitting a variable and need some help. What I have is > some variables with a na

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > $data = "David (man from uncle)"; > > $data = "John Doe (The boy down the hall)"; > > What I want to do is split $data into two string variables, one holding the > $name, and the other holding all the $info that is within the parens. How

Re: Split Problem

2003-03-27 Thread Rob Dixon
Janek Schleicher wrote: > Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > > > $data = "David (man from uncle)"; > > > > $data = "John Doe (The boy down the hall)"; > > > > What I want to do is split $data into two string variables, one holding the > > $name, and the other holding all the

Re: Split Problem

2003-03-27 Thread Stefan Lidman
Janek Schleicher wrote: > > Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > > > $data = "David (man from uncle)"; > > > > $data = "John Doe (The boy down the hall)"; > > > > What I want to do is split $data into two string variables, one holding the > > $name, and the other holding all

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Stefan Lidman wrote at Thu, 27 Mar 2003 13:55:27 +0100: > Janek Schleicher wrote: >> I would use a regexp: >> >> my ($name, $info) = $data =~ /(.*?)\w+\((.*)\)/; > > I guess you ment: > my ($name, $info) = $data =~ /(.*?)\s*\((.*)\)/; Yep. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PR

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: > Janek Schleicher wrote: >> > $data = "David (man from uncle)"; >> > >> > $data = "John Doe (The boy down the hall)"; >> > >> > What I want to do is split $data into two string variables, one holding the >> > $name, and the other holding all

Re: Split Problem

2003-03-27 Thread Rob Dixon
Janek Schleicher wrote: > Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: > > > > > I'm afraid your regex is wrong! It does the following: > > Yep, it was a typo and untested. > > > capture zero or more (as few as possible) of any character > > !! match one or more 'word' characters follow

Re: Split FileName

2003-07-25 Thread John W. Krahn
Pablo Fischer wrote: > > Hi! Hello, > I have a string (its an array, the array has the values that $ftp->ls("dir) > returns), so $array[1] contains this: > -rw-r--r-- 1 pablopablo 18944 Jul 16 21:14 File28903.zip > > What I would like to do is: get the date (Jul 16), the time (12:14

Re: Split FileName

2003-07-26 Thread Janek Schleicher
Pablo Fischer wrote at Fri, 25 Jul 2003 13:49:55 +: > I have a string (its an array, the array has the values that $ftp->ls("dir) > returns), so $array[1] contains this: > -rw-r--r-- 1 pablopablo 18944 Jul 16 21:14 File28903.zip > > What I would like to do is: get the date (Jul 1

RE: Split NewLines

2003-08-18 Thread Hanson, Rob
Like this... $string="1 blabla"; my @lines = split("\n", $string); # testing... print "1: $lines[0]\n"; print "2: $lines[1]\n"; See perldoc -f split if you want more info on the command. Rob -Original Message- From: Pablo Fischer [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003

Re: Split NewLines

2003-08-18 Thread Li Ngok Lam
> > $string="1 > blabla"; > > When Im printing $string I get a new line between 1 and blabla, now I needt o > split that.. in > > my($number, $real_string) = split... my($number, $real_string) = split /\n/, $string; HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-m

Re: split problem

2001-08-05 Thread Me
> What's the problem with my split? > > $line = "var=value"; > ($var, $value) = split(/\s*[=]\s*/, $line); Looks fine to me. > I experienced that $var and $value contained the first letter of the var and > the value. Sometimes nothing. Where is the error? Looks to me like it must be in

Re: split problem

2001-08-05 Thread Michael Kelly
On 8/5/01 9:39 PM, Romek Krisztián wrote: > Hello! > > What's the problem with my split? > > $line = "var=value"; > ($var, $value) = split(/\s*[=]\s*/, $line); > > Krisztian > > I experienced that $var and $value contained the first letter of the var and > the value. Sometimes nothin

Re: split problem

2001-08-08 Thread Narendran Kumaraguru Nathan
Hi Romek, Try with \s*=\s* Naren. Romek Krisztián wrote: > Hello! > > What's the problem with my split? > > $line = "var=value"; > ($var, $value) = split(/\s*[=]\s*/, $line); > > Krisztian > > I experienced that $var and $value contained the first letter of the var and > the value. Som

Re: Split question

2001-08-13 Thread Shane Laffin
Scott, The problem is that | is a pattern metacharacter, and still needs to be escaped. try: my @arr = split(/\Q$CharSep/, $_); # I have a delimited text file with a vertical bar (|) as the column delimiter. When I execute the following statement

Re: Split question

2001-08-13 Thread Jeff 'japhy/Marillion' Pinyan
On Aug 13, Scott and Kristin Seitz said: >$CharSep="\|"; The double quoted string "\|" is still just "|". Use single quotes or the quotemeta() function. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http:/

Re: split array

2002-05-01 Thread drieux
On Wednesday, May 1, 2002, at 02:47 , Greg D. wrote: > Hi, > > Is there any way i can split an array that contains information that i got > from the mysql database? > > here's the code: > > while(my @data = $sth->fetchrow_array){ > print "@data\n"; what does print "$_\n" forea

Re: split array

2002-05-01 Thread bob ackerman
On Wednesday, May 1, 2002, at 02:55 PM, drieux wrote: > > On Wednesday, May 1, 2002, at 02:47 , Greg D. wrote: > >> Hi, >> >> Is there any way i can split an array that contains information that i >> got >> from the mysql database? >> >> here's the code: >> >> while(my @data = $sth->fetchrow_a

Re: split array

2002-05-01 Thread drieux
On Wednesday, May 1, 2002, at 03:04 , bob ackerman wrote: > On Wednesday, May 1, 2002, at 02:55 PM, drieux wrote: >> On Wednesday, May 1, 2002, at 02:47 , Greg D. wrote: >>> here's the code: >>> >>> while(my @data = $sth->fetchrow_array){ >>> print "@data\n"; >> >> what does >> >>

Re: split array

2002-05-01 Thread Chas Owens
On Wed, 2002-05-01 at 17:47, Greg D. wrote: > Hi, > > Is there any way i can split an array that contains information that i got > from the mysql database? > > here's the code: > > while(my @data = $sth->fetchrow_array){ > print "@data\n"; > > right now its prints out for example: >

Re: split array

2002-05-01 Thread Ron
Hello Greg This is a simple method that may work. while ( my @data= $cursor->fetchrow_array ) { $idnum = $row[0]; $username = $row[1]; $email = $row[2]; $code= $row[3]; print "$idnum $username $email $code "; } "Greg D ." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[E

Re: split array

2002-05-01 Thread Chas Owens
On Wed, 2002-05-01 at 18:43, Ron wrote: > Hello Greg > > This is a simple method that may work. > > while ( my @data= $cursor->fetchrow_array ) { > $idnum = $row[0]; > $username = $row[1]; > $email = $row[2]; > $code= $row[3]; > > print "$idnum $username $email $code "; > } > > "Greg

Re: split array

2002-05-01 Thread bob ackerman
On Wednesday, May 1, 2002, at 03:43 PM, Ron wrote: > Hello Greg > > This is a simple method that may work. > > while ( my @data= $cursor->fetchrow_array ) { > $idnum = $row[0]; > $username = $row[1]; > $email = $row[2]; > $code= $row[3]; > > print "$idnum $username $email $code "; > }

Re: split array

2002-05-01 Thread Ron
Oops. As you stated, @row is suppose to be @data. I did assume that the display was in HTML. I guess it's an occupational hazard doing web development. Ron "Chas Owens" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wed, 2002-05-01 at 18:43, Ron wrote: > H

Re: split array

2002-05-01 Thread drieux
On Wednesday, May 1, 2002, at 02:47 , Greg D. wrote: > while(my @data = $sth->fetchrow_array){ > print "@data\n"; > > right now its prints out for example: > > 1 greg [EMAIL PROTECTED] 1234 2 john [EMAIL PROTECTED] 4r434 and so on > > i want it so it prints out.. > > 1 greg [EMAIL PR

Re: split array

2002-05-01 Thread jeff dowd
I like Rons method best, except you could use this instead ov array slot values, which I am not sure will work... while ( my @data= $cursor->fetchrow_hashref ) { $idnum = $data->{'idnum'}; $username = $data-.{'username'}; $email = $data->{'email'}; $code = $data->{'c

Re: split function

2004-09-14 Thread Wiggins d Anconia
> > Hi! > > Can the perl split function split a random 40 character string into five 8 character strings? > > With random I mean that there is no special pattern in the 40 character string that can be used as split markers. > This smells like homework? (just a reminder to the gurus, it is t

Re: split function

2004-09-14 Thread Gunnar Hjalmarsson
C r wrote: Can the perl split function split a random 40 character string into five 8 character strings? With random I mean that there is no special pattern in the 40 character string that can be used as split markers. Don't know, but in any case the m// operator is a better way to do that: my

Re: split function

2004-09-14 Thread Chris Devers
On Tue, 14 Sep 2004, c r wrote: > Can the perl split function split a random 40 character string into > five 8 character strings? > > With random I mean that there is no special pattern in the 40 > character string that can be used as split markers. Wouldn't substr make more sense, or a regex?

RE: split function

2004-09-14 Thread Jim
> Can the perl split function split a random 40 character > string into five 8 character strings? > > With random I mean that there is no special pattern in the 40 > character string that can be used as split markers. How about unpack? @eights = unpack("A8" x (length($string)/8), $string);

Re: split function

2004-09-14 Thread John W. Krahn
c r wrote: Hi! Hello, Can the perl split function split a random 40 character string into five 8 character strings? No. With random I mean that there is no special pattern in the 40 character string that can be used as split markers. You should probably use a match operator. my @strings = $string =

Re: Split question

2007-10-12 Thread yitzle
On 10/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split > the csv file for checking a column value. when spliting I wanted to take Fri, > Oct 12 10:32 AM as a single value. How can I use split? > > Thanks > Manoj If

Re: Split question

2007-10-12 Thread Tom Phoenix
On 10/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > One of the column in csv file is Fri, Oct 12 10:32 AM. I am trying ti split > the csv file for checking a column value. when spliting I wanted to take > Fri, Oct 12 10:32 AM as a single value. How can I use split? You don't want split fo

Re: Split question

2007-10-12 Thread Matthew Whipple
There's a comma in the example data provided. Most of the CSV's I've dealt with also quote values which were strings. If this is the case, an ugly solution would be to use something along the lines of '","' as the delimiter, take into account any possible fields which aren't quoted (it should be

RE: Split function

2007-10-30 Thread Andrew Curry
try chomp(my @strm = split(/\s+/, $IntegrationStream)); as your only splitting on 1 space where 2 are present in your string. -Original Message- From: Sayed, Irfan (Irfan) [mailto:[EMAIL PROTECTED] Sent: 30 October 2007 09:38 To: beginners @ perl. org Subject: Split function Hi All,

Re: Split function

2007-10-30 Thread Paul Lalli
On Oct 30, 5:37 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: > Hi All, > > I have one variable which stores the value as follows. > > "2007-09-07T12:50:26+05:30 aic_8.0_Integration ccvob01" Now my > requirement is that I want to store aic_8.0_Integration part of the > string in different variable.

Re: Split function

2007-10-30 Thread Rob Dixon
Paul Lalli wrote: Annoyingly, split / /, $foo; and split ' ', $foo; are not the same thing. split ' ', $foo is a special case that means to split on all sequences of whitespace. It means the same thing as split /\s+/, $foo; Not quite Paul. From perldoc -f split: A "split" on "/\s+/" is li

Re: Split function

2007-10-30 Thread Paul Lalli
On Oct 30, 1:30 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > Paul Lalli wrote: > > Annoyingly, split / /, $foo; and split ' ', $foo; are not the same > > thing. split ' ', $foo is a special case that means to split on all > > sequences of whitespace. It means the same thing as split /\s+/, > > $foo

Re: Split function

2007-10-30 Thread Dr.Ruud
Andrew Curry schreef: > split(/\s+/, ... Most of the times you think you need /\s+/ with split, you actually want q{ }. See `perldoc -f split`. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://lear

Re: SPLIT QUESTION

2001-05-31 Thread Jeff Pinyan
On May 31, Pedro A Reche Gallardo said: >How can I split a string of caracters -any but blank spaces- into >the individual caracters? So you want to split "what's up, doc?" into @chars = qw( w h a t ' s u p , d o c ? ); That is, every character except spaces? First, remove spaces from t

Re: SPLIT QUESTION

2001-05-31 Thread Brett W. McCoy
> How can I split a string of caracters -any but blank spaces- into > the individual caracters? Try something like this: my @arr = split //, "sometext"; foreach $i (@arr) { print "$i\n"; } -- Brett Brett W. McCoy Software Engineer Broadsoft, Inc. 240-364-5225 [EMAIL PROTECTED]

Re: SPLIT QUESTION

2001-05-31 Thread Randal L. Schwartz
> "Pedro" == Pedro A Reche Gallardo <[EMAIL PROTECTED]> writes: Pedro> How can I split a string of caracters -any but blank spaces- into Pedro> the individual caracters? my @chars = $string =~ /\S/g; -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL

Re: SPLIT QUESTION

2001-05-31 Thread Paul
--- Pedro A Reche Gallardo <[EMAIL PROTECTED]> wrote: > Hi all, > How can I split a string of caracters -any but blank spaces- into > the individual caracters? > Cheers I'd say @chars = split /\s*/, $string; That will split between characters that have any number of spaces between them -

Re: SPLIT QUESTION

2001-05-31 Thread Paul
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote: > > "Pedro" == Pedro A Reche Gallardo > <[EMAIL PROTECTED]> writes: > > Pedro> How can I split a string of caracters -any but blank spaces- > into > Pedro> the individual caracters? > > my @chars = $string =~ /\S/g; I've seen a couple

Re: SPLIT QUESTION

2001-05-31 Thread Jeff Pinyan
On May 31, Paul said: >> my @chars = $string =~ /\S/g; > >I've seen a couple of people doing this, and maybe I'm just confused, >but > >Isn't the point of the original request to split into the original >characters, but leave *out* the spaces? > >and isn't \S any nonspace? > >So, if you split

Re: SPLIT QUESTION

2001-05-31 Thread Paul
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote: > On May 31, Paul said: > > >> my @chars = $string =~ /\S/g; > > > >I've seen a couple of people doing this, and maybe I'm just > confused, > >but > > > >Isn't the point of the original request to split into the original > >characters, but leave *ou

<    1   2   3   4   5   >