Re: split regex

2015-03-21 Thread Brandon McCaig
umar Subas > Oct 12, 2012 12:35:41 AM'; > > I’m trying to perform a split via \s (spaces) delimiter, but > this give me a partial return of "Initial Baseline” (returns > Initial). Is there a regex where I can split using space as the > delimiter, but get all the words inside a q

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

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>> Subjec

split regex

2015-03-19 Thread Danny Wong (dannwong)
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’m trying to perform a split via \s (spaces) delimiter, but this give me

Re: split an html file

2014-04-22 Thread Mike McClain
and wind surfing that has grown too large and should be > >split into smaller sections to reduce load time. > >Can anyone point me to any tools/modules that would automate the > >process of fixing all the links? > > I'm only a beginner in Perl myself so I don&#x

Re: split an html file

2014-04-21 Thread Uday Vernekar
re.html > > about sailing and wind surfing that has grown too large and should be > > split into smaller sections to reduce load time. > > Can anyone point me to any tools/modules that would automate the > > process of fixing all the links? > That's an awesome e

Re: split an html file

2014-04-21 Thread 'lesleyb'
On Thu, Apr 17, 2014 at 10:01:35AM -0700, Mike McClain wrote: > Hi, > My brother Rick, a windrider, put together a webpage, > http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html > about sailing and wind surfing that has grown too large and should be >

Re: split an html file

2014-04-19 Thread Maurice McCarthy
On 2014-04-17 18:01, Mike McClain wrote: Hi, My brother Rick, a windrider, put together a webpage, http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html about sailing and wind surfing that has grown too large and should be split into smaller sections to reduce load

Re: split an html file

2014-04-19 Thread Shlomi Fish
Hi Mike, On Thu, 17 Apr 2014 10:01:35 -0700 Mike McClain wrote: > Hi, > My brother Rick, a windrider, put together a webpage, > http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html > about sailing and wind surfing that has grown too large and should be >

split an html file

2014-04-18 Thread Mike McClain
Hi, My brother Rick, a windrider, put together a webpage, http://www.photographers1.com/Sailing/NauticalTerms&Nomenclature.html about sailing and wind surfing that has grown too large and should be split into smaller sections to reduce load time. Can anyone point me to any tools/mod

split() (Re: sha-2 sum of files?)

2013-06-13 Thread lee
ileinfo;" with $fileinfo[0] >> being the file name, $fileinfo[1] the hash? >> Such 'key:value:...' combinations is probably something frequently >> used. I'm finding some examples to this and don't know what would be >> the best way to do it. &

Re: split

2013-05-03 Thread Edward and Erica Heim
59 PM, Edward and Erica Heim wrote: Hi all, I'm using LWP::UserAgent to access a website. One of the methods returns HTML data e.g. my $data = $response->content; I.e. $data contains the HTML content. I want to be able to parse it line by line e.g. foreach (split /pattern/, $data) {

Re: split

2013-05-03 Thread Shlomi Fish
Hi Rahim, On Fri, 3 May 2013 18:39:57 +0100 Rahim Fakir wrote: > Sorry i not in your level of experience. > If i want to start a mail about perl to wich email should i adress? > I just got started with hello world, and nothing else run's, iam so sad. > Please write a new message to beginners@p

Re: split

2013-05-03 Thread timothy adigun
LWP::UserAgent to access a website. One of the methods returns >> HTML data e.g. >> >> my $data = $response->content; >> >> I.e. $data contains the HTML content. I want to be able to parse it line >> by line e.g. >> >> foreach (split /pattern/, $dat

Re: split

2013-05-03 Thread timothy adigun
> > I.e. $data contains the HTML content. I want to be able to parse it line > by line e.g. > > foreach (split /pattern/, $data) { > my $line = $_; > . > > If I print $data, I can see the individual lines of the HTML data but I'm > not clear on the "patt

Re: split

2013-05-03 Thread Rahim Fakir
ward and Erica Heim wrote: > > Hi all, > > Hello, > > > I'm using LWP::UserAgent to access a website. One of the methods > > returns HTML data e.g. > > > > my $data = $response->content; > > > > I.e. $data contains the HTML content. I want

Re: split

2013-05-03 Thread Brandon McCaig
to be able to parse it > line by line e.g. > > foreach (split /pattern/, $data) { > my $line = $_; > .. > > If I print $data, I can see the individual lines of the HTML data > but I'm not clear on the "pattern" that I should use in split or if

Re: split

2013-05-03 Thread Jim Gibson
to parse it line by > line e.g. > > foreach (split /pattern/, $data) { >my $line = $_; > .. > > If I print $data, I can see the individual lines of the HTML data but I'm not > clear on the "pattern" that I should use in split or if there is a better

Re: split

2013-05-03 Thread Mike Dunaway
So you want to split the HTML in a way that $_ becomes one full line of text? It really depends how the HTML is written. If it's written all on one line (which is the case sometimes) you would probably need to go another route. If the HTML is written on multiple lines (and it should b

split

2013-05-03 Thread Edward and Erica Heim
Hi all, I'm using LWP::UserAgent to access a website. One of the methods returns HTML data e.g. my $data = $response->content; I.e. $data contains the HTML content. I want to be able to parse it line by line e.g. foreach (split /pattern/, $data) { my $line = $_; .. If

Re: split

2012-04-09 Thread John W. Krahn
Matthew Bonner wrote: Hi Anamika I know this thread has focussed on using split -- thought I'd add a regex powered version for reference/comparison. cheers Matthew use strict; use warnings; while () { my @keys; @keys = $_ =~ m/(NM_\d+)+/g; $_ =~ m/

Re: split

2012-04-09 Thread Matthew Bonner
Hi Anamika I know this thread has focussed on using split -- thought I'd add a regex powered version for reference/comparison. cheers Matthew use strict; use warnings; while () { my @keys; @keys = $_ =~ m/(NM_\d+)+/g; $_ =~ m/\:1\s+(.*)$/; print "

Re: split

2012-04-05 Thread Dr.Ruud
On 2012-04-04 16:33, lina wrote: my ($keys, $value) = split /[ ]+/, $line; That is better written as split " ", $line; See perldoc -f split, about this special (and default) split mode. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional comman

Re: split

2012-04-05 Thread mohan . p
Not sure about the code but i think below logic might work, 1) split the line into two parts , one is patterns and another is values 2) split /assign the patterns to an array and take the count 3) write a loop till the above count is reach and use the value taken in first step for each pattern

Re: split

2012-04-04 Thread Rob Dixon
0.955794504181601 NM_001042541:1 0.955794504181601 NM_019584:1 0.900900900900901 NM_198862:1 0.835755813953488 NM_001039093 0.805008944543828 NM_001039092 0.805008944543828 NM_153080:1 0.805008944543828 I am using split function first to separate column 1 with column 2 and then based upon

Re: split

2012-04-04 Thread lina
3828 > > and want output like this: > > NM_009648  0.955794504181601 > NM_001042541:1  0.955794504181601 > NM_019584:1     0.900900900900901 > NM_198862:1     0.835755813953488 > NM_001039093  0.805008944543828 > NM_001039092   0.805008944543828 > NM_153080:1  0.

Re: split

2012-04-04 Thread Shawn H Corey
On 12-04-04 08:57 AM, Anamika K wrote: Could you please suggest my how to proceed? You should use two splits: one to separate the data by white space into two; and another to separate the first datum by commas. -- Just my 0.0002 million dollars worth, Shawn Programming is as much abo

Re: split

2012-04-04 Thread timothy adigun
> NM_001039092 0.805008944543828 > NM_153080:1 0.805008944543828 > > I am using split function first to separate column 1 with column 2 and > then based upon "comma" I need to split column 1. But as you can see, > in the column 1, there are sometimes more than

split

2012-04-04 Thread Anamika K
0.955794504181601 NM_019584:1 0.900900900900901 NM_198862:1 0.835755813953488 NM_001039093 0.805008944543828 NM_001039092 0.805008944543828 NM_153080:1 0.805008944543828 I am using split function first to separate column 1 with column 2 and then based upon "comma" I need to split col

Re: Split and concatenation

2011-12-19 Thread Brandon McCaig
On Sat, Dec 17, 2011 at 08:22:31AM +, vishnu.kuma...@wipro.com wrote: > Hi, Hello: > I am trying to convert the string abc.def.ghi.amm to > abcdefghiamm using split and concatenation. I am missing > something somewhere.. please help me to fix the code > > my $string

RE: Split and concatenation

2011-12-19 Thread T D, Vishnu
Thanks guys for your suggestion -Original Message- From: Shlomi Fish [mailto:shlo...@shlomifish.org] Sent: Saturday, December 17, 2011 2:48 PM To: vishnu.kuma...@wipro.com Cc: beginners@perl.org Subject: Re: Split and concatenation Hi Vishnu, On Sat, 17 Dec 2011 08:22:31 +

Re: Split and concatenation

2011-12-18 Thread Dr.Ruud
On 2011-12-17 09:20, T D, Vishnu wrote: I am trying to convert the string abc.def.ghi.amm to abcdefghiamm $string =~ s/\.+//g using split and concatenation. join "", split /\.+/, $string -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additiona

Split and concatenation

2011-12-17 Thread T D, Vishnu
Hi, I am trying to convert the string abc.def.ghi.amm to abcdefghiamm using split and concatenation. I am missing something somewhere.. please help me to fix the code my $string = "abc.def.ghi.amm"; my @d = split(/\./,"$string"); my $e = @d; for (my $i=0; $i < $e; $i++

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 and concatenation

2011-12-17 Thread John W. Krahn
vishnu.kuma...@wipro.com wrote: Hi, Hello, I am trying to convert the string abc.def.ghi.amm to abcdefghiamm using split and concatenation. I am missing something somewhere. . please help me to fix the code my $string = "abc.def.ghi.amm"; my @d = split(/\./,"$string");

Re: Split and concatenation

2011-12-17 Thread Shlomi Fish
Hi Vishnu, On Sat, 17 Dec 2011 08:22:31 + wrote: > Hi, > > I am trying to convert the string abc.def.ghi.amm to abcdefghiamm using split > and concatenation. I am missing something somewhere.. please help me to fix > the code > > my $string = "abc.def.gh

Split and concatenation

2011-12-17 Thread vishnu.kumartd
Hi, I am trying to convert the string abc.def.ghi.amm to abcdefghiamm using split and concatenation. I am missing something somewhere.. please help me to fix the code my $string = "abc.def.ghi.amm"; my @d = split(/\./,"$string"); my $e = @d; for (my $i=0; $i < $e; $i++

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) {

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 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 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-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-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 > >> cont

RE: split function

2011-12-15 Thread Ken Slater
> To: Perl Beginners > Cc: Ken Slater; Chris Stinemetz > Subject: Re: split function > > On 15/12/2011 16:09, Ken Slater wrote: > > > > I have not been following this too closely, but I don't understand > the > > algorithm used to get the above ou

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Tool completed successfully > Thank you Rob! This is what I was trying to accomplish. I'm going to have to research to find out exactly what you did. Thanks agian, Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http:

Re: split function

2011-12-15 Thread Rob Dixon
On 15/12/2011 16:09, Ken Slater wrote: I have not been following this too closely, but I don't understand the algorithm used to get the above output. What is that Ken? If you don't understand the question then ask some questions of your own! I would have named it @fieldValues since arrays

Re: split function

2011-12-15 Thread Rob Dixon
On 15/12/2011 15:47, Chris Stinemetz wrote: > > I'm getting a bit closer. There a couple roadblocks I am up against. > > I am able to split the lines by white space, but for some reason the > program isn't capturing the first lines to the @fieldValue array after > the

RE: split function

2011-12-15 Thread Ken Slater
> -Original Message- > From: Ken Slater [mailto:kl...@psu.edu] > Sent: Thursday, December 15, 2011 11:09 AM > To: 'Chris Stinemetz'; 'John W. Krahn' > Cc: 'Perl Beginners' > Subject: RE: split function > > > -Original M

Re: split function

2011-12-15 Thread Chris Stinemetz
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. >> Thus far I am having trouble figuring out how to split t

Re: split function

2011-12-15 Thread Dr.Ruud
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. Thus far I am having trouble figuring out how to split the first line. You have an XY problem, you are probably looking for http

RE: split function

2011-12-15 Thread Ken Slater
> -Original Message- > From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] > Sent: Thursday, December 15, 2011 10:47 AM > To: John W. Krahn > Cc: Perl Beginners > Subject: Re: split function > > I'm getting a bit closer. There a couple roadblocks I am

Re: split function

2011-12-15 Thread Chris Stinemetz
I'm getting a bit closer. There a couple roadblocks I am up against. I am able to split the lines by white space, but for some reason the program isn't capturing the first lines to the @fieldValue array after the @headerNames array. Once I get all the lines to go into the array correct

Re: split function

2011-12-14 Thread John W. Krahn
timothy adigun wrote: Hi Chris, Please check added code to yours, in addition to what John wrote; I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like

Re: split function

2011-12-14 Thread timothy adigun
Hi Chris, Please check added code to yours, in addition to what John wrote; I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like the first line to be

Re: split function

2011-12-13 Thread John W. Krahn
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. Thus far I am having trouble figuring out how to split the first line. I would like the first line to be split so it looks like the following with the "=&

split function

2011-12-13 Thread Chris Stinemetz
I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like the first line to be split so it looks like the following with the "=" sign added. Th

Re: How to grab last element of array from split with no temporary variables?

2011-08-18 Thread Brandon McCaig
On Wed, Aug 17, 2011 at 9:58 PM, Randal L. Schwartz wrote: > Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, and I wish they'd damn well > stop. In my experience, people outside of the Perl community perceive /any/ Perl as obfuscated anyway

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread timothy adigun
> Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, What is golf? Hi Marc, Perl "golf" is a game where one reduce the number of characters {key "strokes"} used in a perl program, just like how golf players seek to hit balls into series

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread sono-io
On Aug 17, 2011, at 6:58 PM, Randal L. Schwartz wrote: > Golfers do NOT understand the DAMAGE they are doing to Perl's > perception outside the Perl community, What is golf? Marc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@

Re: How to grab last element of array from split with no temporary variables?

2011-08-17 Thread Randal L. Schwartz
> ""John" == "John W Krahn" writes: >> That's deprecated though, if not already gone. (Looks gone in Perl >> 5.14.) It was a readily-admitted misfeature. John> Unless you're playing golf. :-) I'd argue that Golf itself is a misfeature of Perl. More like a bug. Golfers do NOT understan

Re: How to grab last element of array from split with no temporary variables?

2011-08-14 Thread Peter Scott
fried >>> >>> find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, >>> "./$p[$#p].txt" } ' >> >> Try this: >> >> find /xyz -type f -print0 | perl -F/ -0lane 'rename $_,"$F[-1].txt" or >>

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread John W. Krahn
Randal L. Schwartz wrote: "John" == "John W Krahn" writes: John> split() uses @_ by default so you could just say: That's deprecated though, if not already gone. (Looks gone in Perl 5.14.) It was a readily-admitted misfeature. Unless you're playing golf.

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Randal L. Schwartz
>>>>> "John" == "John W Krahn" writes: John> split() uses @_ by default so you could just say: That's deprecated though, if not already gone. (Looks gone in Perl 5.14.) It was a readily-admitted misfeature. -- Randal L. Schwartz - Stonehenge Consul

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Rob Dixon
On 12/08/2011 18:52, Rob Dixon wrote: > On 12/08/2011 00:17, siegfr...@heintze.com wrote: >> This works! Is there a way to do it with less typing? How can I do it >> without creating a temporary variable "@p"? >> Thanks, >> siegfried >> >> fin

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Rob Dixon
On 12/08/2011 00:17, siegfr...@heintze.com wrote: This works! Is there a way to do it with less typing? How can I do it without creating a temporary variable "@p"? Thanks, siegfried find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, "./$p[$#p].t

Re: How to grab last element of array from split with no temporary variables?

2011-08-12 Thread Brandon McCaig
On Thu, Aug 11, 2011 at 7:17 PM, wrote: > find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, > "./$p[$#p].txt" } ' If I'm reading this right then it looks like you're trying to recursively move all files in /xyz into the curren

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread John W. Krahn
ing a temporary variable "@p"? Thanks, siegfried find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, "./$p[$#p].txt" } ' Try this: find /xyz -type f -print0 | perl -F/ -0lane 'rename $_,"$F[-1].txt" or warn $!' That

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Peter Scott
ry variable "@p"? Thanks, > siegfried > > find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, > "./$p[$#p].txt" } ' Try this: find /xyz -type f -print0 | perl -F/ -0lane 'rename $_,"$F[-1].txt" or warn $!'

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread John W. Krahn
Shawn H Corey wrote: On 11/08/11 07:17 PM, siegfr...@heintze.com wrote: This works! Is there a way to do it with less typing? How can I do it without creating a temporary variable "@p"? Thanks, siegfried find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/";

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Jim Bauer
On Thu, 11 Aug 2011 16:17:51 -0700, wrote: > This works! Is there a way to do it with less typing? How can I do it > without creating a temporary variable "@p"? rename($_, sprintf("./%s.txt", (split '/')[-1])); -- To unsubscribe, e-mail: beginners-unsubscr

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Jim Gibson
On 8/11/11 Thu Aug 11, 2011 4:17 PM, "siegfr...@heintze.com" scribbled: > This works! Is there a way to do it with less typing? How can I do it > without creating a temporary variable "@p"? > Thanks, > siegfried > > find /xyz -exec perl -e 'foreach(

Re: How to grab last element of array from split with no temporary variables?

2011-08-11 Thread Shawn H Corey
On 11/08/11 07:17 PM, siegfr...@heintze.com wrote: This works! Is there a way to do it with less typing? How can I do it without creating a temporary variable "@p"? Thanks, siegfried find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, "./$p[$#p].

How to grab last element of array from split with no temporary variables?

2011-08-11 Thread siegfried
This works! Is there a way to do it with less typing? How can I do it without creating a temporary variable "@p"? Thanks, siegfried find /xyz -exec perl -e 'foreach(@ARGV){ my @p=split "/"; rename $_, "./$p[$#p].txt" } ' -- To unsubscribe, e-mail: begin

Re: split & re

2011-05-16 Thread Mike McClain
On Sun, May 15, 2011 at 11:51:35AM -0700, John W. Krahn wrote: > > split ' ', $line; > > John Smacking my forehead in chagrin. :-) You're absolutely right John, I just didn't read far enough. Thank you, Mike -- Satisfied user of Linux since 1997. O< asc

Re: split & re

2011-05-16 Thread Dr.Ruud
On 2011-05-15 18:28, Mike McClain wrote: In reading in a file of space separated columns of numbers and stuffing them into an array, I used: while( my $line =<$FH> ) { my @arr = split /\s+/, $line; push @primes_array, @arr; } but kept getting empty array e

Re: split & re

2011-05-15 Thread charley
On May 15, 12:28 pm, mike.j...@cox.net (Mike McClain) wrote: > In reading in a file of space separated columns of numbers > and stuffing them into an array, I used: >     while( my $line = <$FH> ) >     {   my @arr = split /\s+/, $line; >         push @primes_array, @arr;

Re: split & re

2011-05-15 Thread John W. Krahn
Mike McClain wrote: In reading in a file of space separated columns of numbers and stuffing them into an array, I used: while( my $line =<$FH> ) { my @arr = split /\s+/, $line; push @primes_array, @arr; } but kept getting empty array entries until I switc

split & re

2011-05-15 Thread Mike McClain
In reading in a file of space separated columns of numbers and stuffing them into an array, I used: while( my $line = <$FH> ) { my @arr = split /\s+/, $line; push @primes_array, @arr; } but kept getting empty array entries until I switched to: while( <$FH>

Re: array like split of string

2011-01-26 Thread Peter K. Michie
On Jan 23, 2:55 am, jwkr...@shaw.ca ("John W. Krahn") wrote: > Peter K. Michie wrote: > > I have this regex expression in a script that appears to do an array > > like split of a string but I cannot figure out how it does so. Any > > help appreciated > > &

Re: array like split of string

2011-01-23 Thread John W. Krahn
Peter K. Michie wrote: I have this regex expression in a script that appears to do an array like split of a string but I cannot figure out how it does so. Any help appreciated $fname = ($0 =~ m[(.*/)?([^/]+)$])[1] ; print "7 $errlog\n"; $fpath = ($0 =~ m[(.*/)?([^/]+)$])[0] ; print

array like split of string

2011-01-23 Thread Peter K. Michie
I have this regex expression in a script that appears to do an array like split of a string but I cannot figure out how it does so. Any help appreciated $fname = ($0 =~ m[(.*/)?([^/]+)$])[1] ; print "7 $errlog\n"; $fpath = ($0 =~ m[(.*/)?([^/]+)$])[0] ; print "8 $errlog\n";

Re: Split function

2010-11-29 Thread Kenneth Wolcott
Hi; >>   The reason one should use File::Basename and File::Spec is that you >> can become platform-independent instead of Windoze-worshipping :-) > > What does the operating system have to do with this? > > OP asked how to split a string, I gave an example how to do it

Re: Split function

2010-11-29 Thread Dr.Ruud
On 2010-11-29 02:27, Kenneth Wolcott wrote: On Sun, Nov 28, 2010 at 12:31, Dr.Ruud wrote: On 2010-11-28 10:54, Chaitanya Yanamadala wrote: How do i split a value like this F:\test\test123\test1233 For example: ruud$ perl -wle 'print for split //, q{F:\test\test123\test1233}' F

Re: Split function

2010-11-29 Thread Brian Fraser
> > For a Windows shop, the overhead of platform independence is redundant, > Premature optimization much? Brian.

Re: Split function

2010-11-29 Thread Uri Guttman
> "ES" == Erez Schatz writes: ES> On 11/29/2010 03:27 AM, Kenneth Wolcott wrote: >> >> The reason one should use File::Basename and File::Spec is that you >> can become platform-independent instead of Windoze-worshipping :-) >> >> Ken Wolcott >> ES> I worship whatever I'm

Re: Split function

2010-11-29 Thread Erez Schatz
On 11/29/2010 03:27 AM, Kenneth Wolcott wrote: > > The reason one should use File::Basename and File::Spec is that you > can become platform-independent instead of Windoze-worshipping :-) > > Ken Wolcott > I worship whatever I'm paid to work on. For a Windows shop, the overhead of platform in

Re: Split function

2010-11-28 Thread Kenneth Wolcott
Hi; On Sun, Nov 28, 2010 at 12:31, Dr.Ruud wrote: > On 2010-11-28 10:54, Chaitanya Yanamadala wrote: > >> How do i split a value like this >> F:\test\test123\test1233 > > For example: > > ruud$ perl -wle 'print for split //, q{F:\test\test123\test1233}'

Re: Split function

2010-11-28 Thread Dr.Ruud
On 2010-11-28 10:54, Chaitanya Yanamadala wrote: How do i split a value like this F:\test\test123\test1233 For example: ruud$ perl -wle 'print for split //, q{F:\test\test123\test1233}' F : \ t e s t \ t e s t 1 2 3 \ t e s t 1 2 3 3 -- Ruud -- To unsubscribe, e-mail: beginner

Re: Split function

2010-11-28 Thread Téssio Fechine
Take extra caution with the backslash-scapes.. --- use 5.010; use strict; use warnings; my $str1 = "F:\test\test123\test1233"; #Wrong! Backslash being expanded! my $str2 = 'F:\test\test123\test1233'; my @array1 = split(/\\/, $str1); my @array2 = split(/\\/, $str2); my $

Re: Split function

2010-11-28 Thread Parag Kalra
>>How do i split a value like this >>F:\test\test123\test1233 use strict; use warnings; my $str='F:\test\test123\test1233'; my @values = split /\\/, $str; print "@values"; Cheers, Parag On Sun, Nov 28, 2010 at 1:54 AM, Chaitanya Yanamadala < dr.virus.in...@

Re: Split function

2010-11-28 Thread Shlomi Fish
Hi Chaitanya, On Sunday 28 November 2010 11:54:14 Chaitanya Yanamadala wrote: > How do i split a value like this > F:\test\test123\test1233 > > please help me with this.. > You should use File::Spec (and related modules such as File::Basename) to manipulate path names, instead

Split function

2010-11-28 Thread Chaitanya Yanamadala
How do i split a value like this F:\test\test123\test1233 please help me with this.. Regards Chaitanya

Re: split log file

2010-10-18 Thread Shlomi Fish
Hi Agnello, On Monday 18 October 2010 15:01:56 Agnello George wrote: > I know the problem is solved but Could the script be done like this ?? > OK, I'll answer it. > #!/usr/bin/perl > > use strict; > use warnings; > > > while (my $line = ) { Why are you using *DATA and __DATA__ for the data

Re: split log file

2010-10-18 Thread Agnello George
On Sat, Oct 16, 2010 at 2:11 PM, Shlomi Fish wrote: > On Thursday 14 October 2010 16:54:32 yo RO wrote: > > Hello I need to split a log file per days > > I have a file in txt format and I want to create a file with all data > > from one day in one file > > I will give

Re: split log file

2010-10-18 Thread Agnello George
0;11:12\\trafic info 3_23_2010;11:34\\trafic info On Sat, Oct 16, 2010 at 2:11 PM, Shlomi Fish wrote: > On Thursday 14 October 2010 16:54:32 yo RO wrote: > > Hello I need to split a log file per days > > I have a file in txt format and I want to create a file with all data > > f

Re: split log file

2010-10-18 Thread yo RO
On Oct 16, 10:41 am, shlo...@iglu.org.il (Shlomi Fish) wrote: > On Thursday 14 October 2010 16:54:32 yo RO wrote: > > > > > Hello I need to split a log file per days > > I have a file in txt format and I want to create a file with all data > > from one day in on

Re: split log file

2010-10-16 Thread Parag Kalra
use strict; use warnings; my %log; while(){ chomp; my ($key, $value) = split /;/, $_; push @{$log{$key}}, $value; } foreach my $k (keys %log){ open my $k_fh, '>', "$k.log" or die "Could not open the file - $k.log : $! \n"; foreach my $v

Re: split log file

2010-10-16 Thread Shlomi Fish
On Thursday 14 October 2010 16:54:32 yo RO wrote: > Hello I need to split a log file per days > I have a file in txt format and I want to create a file with all data > from one day in one file > I will give example > > I have this imput > 3_21_2010;11:12\\trafic info >

Re: split log file

2010-10-16 Thread Rob Coops
On Thu, Oct 14, 2010 at 4:54 PM, yo RO wrote: > Hello I need to split a log file per days > I have a file in txt format and I want to create a file with all data > from one day in one file > I will give example > > I have this imput > 3_21_2010;11:12\\trafic info > 3_21

split log file

2010-10-16 Thread yo RO
Hello I need to split a log file per days I have a file in txt format and I want to create a file with all data from one day in one file I will give example I have this imput 3_21_2010;11:12\\trafic info 3_21_2010;11:34\\trafic info 3_21_2010;13:21\\trafic info 3_22_2010;11:12\\trafic info

  1   2   3   4   5   6   7   8   9   10   >