SPLIT QUESTION

2001-05-31 Thread Pedro A Reche Gallardo
Hi all, How can I split a string of caracters -any but blank spaces- into the individual caracters? Cheers - -- *** PEDRO a. RECHE gallardo, pHDTL: 617 632 3824 Scientist, Mol.Immnunol.Foundation, FX: 617

Split question

2001-08-13 Thread Scott and Kristin Seitz
I have a delimited text file with a vertical bar (|) as the column delimiter. When I execute the following statement... @Line = split(/\|/, $_); ...I get the expected results. When I execute the following... $CharSep="\|"; @Line = split(/$CharSep/, $_); ...the file seems to break at every c

Split question

2003-12-13 Thread Perl
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 But @temp = split(/#/, "abc#def#ghi#jkl") ; doesn't seem to work. am i do

split// question

2002-03-10 Thread Karsten Borgwaldt
Hi all, i have a problem to split data of a file. The data has the following structure : key=value key2=value2 When reading this file, there's no problem, but if I want to split the lines... This is the sourcecode: open(file, "< foo.bar"); @myArray = ; close(file); foreach (@myArray) {($

Split question

2007-10-12 Thread manojkumarg
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 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

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

Re: SPLIT QUESTION

2001-05-31 Thread Jeff Pinyan
On May 31, Paul said: >Still, though, won't that return all the *strings* as elements, rather >than the individual characters? and wouldn't \S* solve that difference? We're only matching ONE character at a time: @all_chars = $str =~ /./sg; @all_ws = $str =~ /\s/g; @all_non_ws = $str

Re: SPLIT QUESTION

2001-05-31 Thread Paul
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote: > On May 31, Paul said: > > >Still, though, won't that return all the *strings* as elements, > rather > >than the individual characters? and wouldn't \S* solve that > difference? > > We're only matching ONE character at a time: > > @all_chars = $st

Re: SPLIT QUESTION

2001-05-31 Thread Piers Cawley
Jeff Pinyan <[EMAIL PROTECTED]> writes: > 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

Simple Split Question

2001-06-29 Thread Seitz, Scott
I'm having trouble with what I think is a very simple split question. I've got a line of text something like: DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None" I want a hash with (1, "All", 2, "Some", 3, &qu

Simple split() question

2001-06-30 Thread Sanjeeb Basak
Hi, I want to perform a simple split operation, but can't get the regular expr working. Can anybody help me on this? my $line from a file read is: xyz abc 12sd "pqr stz" dfg (delimited by blank char). I'm doing my ($par1, $par2, $par3, $par4, $par5) = split(/ /, $line); and I'm getting $par4 =

A Split Question

2001-07-03 Thread paul
Hi. My file has dates in it that either come out as "2Jul2001" or "21Jul2001". So one or two digits for the day, three for the month, and four for the year. So I would like to split out the day, month, year, and am interested in splitting techniques, where there are no delimeters. Of course

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:/

a split(); question

2003-01-21 Thread justino berrun
#hello, is there a way to split a string between a digit and character #without losing the digit or the character #Any help would be very appreciated $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three new strings @newstrings=split(/(\d)([a-zA-Z])/,$string);

Simple split question

2003-03-31 Thread jdavis
Hello, I have a sentince I would like to split on a word and keep everything right of the "split word". I cant seem to get this to work. Could over me some advice. Thanks, -- jd [EMAIL PROTECTED] Bad spellers of the world untie! "I can't tell if I have worked all my life or if I have never w

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 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// question

2002-03-10 Thread Jeff 'japhy' Pinyan
On Mar 10, Karsten Borgwaldt said: >key=value >key2=value2 > > >This is the sourcecode: I can assure you it isn't; your code assigns to $1, $2, and $3 -- you can't do that. >open(file, "< foo.bar"); If you had warnings on, you'd be told that filehandles should be written in uppercase for s

Re: split// question

2002-03-10 Thread Jonathan E. Paton
> The reason your code breaks is because you are > misunderstanding split(); it does NOT return what > the regex matched. > > split /=/, "a=b" > > does not return ("a", "=", "b"). It returns ("a", "b"). Unless of course you write split as: split /(=)/, "a=b"; But you rarely, if ever, need

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: Simple Split Question

2001-06-29 Thread Ken
mumble* Took me a few minutes to figure out why! - Original Message - From: "Seitz, Scott" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 28, 2001 2:32 PM Subject: Simple Split Question > I'm having trouble with what I think is a very simple

Re: Simple Split Question

2001-06-29 Thread Brett W. McCoy
On Thu, 28 Jun 2001, Seitz, Scott wrote: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"

Re: Simple Split Question

2001-06-29 Thread Paul
--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimV

RE: Simple Split Question

2001-06-29 Thread Stephen Nelson
ot;([^"]+)"/g; That gives me %foo as (according to Data::Dumper): { 1 => 'All', 2 => 'Some', 3 => 'Most', 4 => 'None' }; > -Original Message- > From: Seitz, Scott [mailto:[EMAIL PROTECT

Re: Simple Split Question

2001-06-29 Thread Abdulaziz Ghuloum
z,,, On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said: > I'm having trouble with what I think is a very simple split question. > > I've got a line of text something like: > > DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimVie

Re: Simple split() question

2001-06-30 Thread Jeff 'japhy' Pinyan
On Jun 30, Sanjeeb Basak said: >I want to perform a simple split operation, but can't get the regular expr >working. Can anybody help me on this? > >my $line from a file read is: >xyz abc 12sd "pqr stz" dfg (delimited by blank char). > >I'm doing >my ($par1, $par2, $par3, $par4, $par5) = split(/

Re: Simple split() question

2001-06-30 Thread Eric Beaudoin
At 01:40 2001.07.01, Jeff 'japhy' Pinyan wrote: >On Jun 30, Sanjeeb Basak said: > >>I want to perform a simple split operation, but can't get the regular expr >>working. Can anybody help me on this? >> >>my $line from a file read is: >>xyz abc 12sd "pqr stz" dfg (delimited by blank char). >> >>I'm

Re: A Split Question

2001-07-03 Thread Pierre Smolarek
my $dateis = "2Jul2001"; my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/; print "$date - $month - $year \n"; :) with regards, Pierre - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 03

RE: A Split Question

2001-07-03 Thread John Edwards
ear\n"; } John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 03 July 2001 12:24 To: [EMAIL PROTECTED] Subject: A Split Question Hi. My file has dates in it that either come out as "2Jul2001" or "21Jul2001". So one or two digits for the day,

Re: A Split Question

2001-07-03 Thread Luke Bakken
my @dates = qw(2Jul2001 21Jul2001); for my $date (@dates) { my ($month, $day, $year) = length $date == 8 ? unpack 'AA3A4', $date : unpack 'A2A3A4', $date; print "M: ", $month, "\tD: ", $day, "\tY: ",

Re: A Split Question

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, Luke Bakken wrote: > my @dates = qw(2Jul2001 21Jul2001); > > for my $date (@dates) > { > my ($month, $day, $year) = > length $date == 8 ? > unpack 'AA3A4', $date : > unpack 'A2A3A4', $date; > >

Re: A Split Question

2001-07-03 Thread Luke Bakken
> > Unpack works well with fixed format data like this. > > Why would you use unpack when this can be easily split apart with a regex? > I'd think unpack would be overkill! > > -- Brett if you had thousands of dates to split up, unpack is much faster than regexes. way way faster. Luke

RE: A Split Question

2001-07-03 Thread Will Crain
-- Original Message -- >My file has dates in it that either come out as "2Jul2001" or "21Jul2001". > So one or two digits for the day, three for the month, and four for the >year. > >So I would like to split out the day, month, year, and am interested in >splitting techniques, where there are n

RE: A Split Question

2001-07-03 Thread John Edwards
01 15:41 To: [EMAIL PROTECTED] Subject: RE: A Split Question -- Original Message -- >My file has dates in it that either come out as "2Jul2001" or "21Jul2001". > So one or two digits for the day, three for the month, and four for the >year. > >So I would like t

Re: A Split Question

2001-07-03 Thread Pierre Smolarek
--- From: "John Edwards" <[EMAIL PROTECTED]> To: "'Will Crain'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 03, 2001 3:54 PM Subject: RE: A Split Question > Sorry to pick holes in your first post to the list ;) but this part of y

Re: A Split Question

2001-07-03 Thread Pierre Smolarek
$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/; > > It makes me sleeper at night > > > - Original Message - > From: "John Edwards" <[EMAIL PROTECTED]> > To: "'Will Crain'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >

Re: A Split Question

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, Luke Bakken wrote: > > > > Unpack works well with fixed format data like this. > > > > > > Why would you use unpack when this can be easily split apart with a regex? > > > I'd think unpack would be overkill! > > why is it overkill any more that a regex? Are you saying we shou

Re: A Split Question

2001-07-03 Thread Jos Boumans
on a side note, if you CAN use perls internal char classes you really want to do that firstly to avoid typos, secondly, they're much faster. and if you're using the same regexp over and over again, you *might* want to concider building it outside the loop with the /o switch (this all performace b

Re: a split(); question

2003-01-21 Thread Janek Schleicher
On Wed, 22 Jan 2003 02:46:27 +0800, Justino Berrun wrote: > #hello, is there a way to split a string between a digit and character > #without losing the digit or the character > #Any help would be very appreciated > > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three

RE: a split(); question

2003-01-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
justino berrun wrote: > #hello, is there a way to split a string between a digit and character > #without losing the digit or the character > #Any help would be very appreciated > > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would > make three new strings > > @newstrings=split(

Re: a split(); question

2003-01-21 Thread Rob Dixon
Justino Berrun wrote: > #hello, is there a way to split a string between a digit and character > #without losing the digit or the character > #Any help would be very appreciated > > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would > make three new strings > > @newstrings=split(/(\

Re: a split(); question

2003-01-21 Thread John W. Krahn
Rob Dixon wrote: > > Justino Berrun wrote: > > #hello, is there a way to split a string between a digit and character > > #without losing the digit or the character > > #Any help would be very appreciated > > > > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would > > make three new

Re: a split(); question

2003-01-21 Thread R. Joseph Newton
justino berrun wrote: > #hello, is there a way to split a string between a digit and character > $string='hello...4546perl...2366Pogrammers..3435'; #e.g. would make three new >strings Try: (my $ElementString = $string) =~ s /(\d+)(\D+)/$1-$2/g; print "$ElementString\n"; $ElementString is th

RE: Simple split question

2003-03-31 Thread Dan Muey
> Hello, > I have a sentince I would like to split on a word and keep > everything right of the "split word". I cant seem to get this > to work. Could over me some advice. Split returns in list context so :: @stuff = split(/word/, $sentence); Or ($left,$right) = split(/word/, $sentence); A

RE: Simple split question

2003-03-31 Thread Timothy Johnson
; -Original Message- From: jdavis [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 2:36 PM To: perl Subject: Simple split question Hello, I have a sentince I would like to split on a word and keep everything right of the "split word". I cant seem to get this to work. Coul

RE: Simple split question

2003-03-31 Thread jdavis
> > ($left,$right) = split(/word/, $sentence); > I am trying this but its not working. Im lost :) could someone take a look... This is the beggining of a scrip to make reports based on droped iptable packets thanks jd # #!/usr/bin/perl -w $fi

RE: Simple split question

2003-03-31 Thread jdavis
I found the error. Sorry to answer my own queston I was trying (@bad,@good) = split(/ /, $string); when i needed ($bad,$good) = split(/ /, $string); thanks for all the help. jd On Mon, 2003-03-31 at 16:18, jdavis wrote: > > > > ($left,$right) = split(/word/, $sentence); > > > > I am trying

Re: Simple split question

2003-03-31 Thread R. Joseph Newton
jdavis wrote: > I found the error. Sorry to answer my own queston > I was trying > > (@bad,@good) = split(/ /, $string); > > when i needed > > ($bad,$good) = split(/ /, $string); > > thanks for all the help. > > jd If you had chosen to use strict; your compiler would have brought this to your att

RE: Simple split question

2003-04-01 Thread Scott R. Godin
Jdavis wrote: >> >> ($left,$right) = split(/word/, $sentence); >> > > I am trying this but its not working. Im lost :) > could someone take a look... > > This is the beggining of a scrip to make reports > based on droped iptable packets I've done something like this with my tailfilter project

RE: Simple split question

2003-04-01 Thread jdavis
your project looks nice and usefull. What i am making will utilze graphs & a sql database. I want to graph all packets droped the last-hour, today, this-week, this year. Eventully i would like to establish traffic patterns so i can wright more abstract rules that what iptables can do. If anyone is

RE: Re: A Split Question

2001-07-03 Thread paul
01 >my $dateis = "2Jul2001"; >my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/; > >print "$date - $month - $year \n"; > >:) > >with regards, > >Pierre > >- Original Message - >From: <[EMAIL PROTECTED]>

Re[2]: A Split Question

2001-07-03 Thread Maxim Berlin
Hello Brett, Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote: >> > > > Unpack works well with fixed format data like this. >> > > >> > > Why would you use unpack when this can be easily split apart with a regex? >> > > I'd think unpack would be overkill! >> >> why is it overkill

Re[4]: A Split Question

2001-07-03 Thread Maxim Berlin
Hello Brett, Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote: >> >> > > > Unpack works well with fixed format data like this. >> >> > > >> >> > > Why would you use unpack when this can be easily split apart with a regex? >> >> > > I'd think unpack would be overkill! >> >> >> >>

Re: Re[2]: A Split Question

2001-07-03 Thread Brett W. McCoy
On Tue, 3 Jul 2001, Maxim Berlin wrote: > Tuesday, July 03, 2001, Brett W. McCoy <[EMAIL PROTECTED]> wrote: > > >> > > > Unpack works well with fixed format data like this. > >> > > > >> > > Why would you use unpack when this can be easily split apart with a regex? > >> > > I'd think unpack would

Re: Re[2]: A Split Question

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, Maxim Berlin said: > my ($month, $day, $year) = /(\d+)(\D+)(\d+)/; I'd be evil and do: my ($mon, $day, $yr) = split /(\D+)/; Now *that* is quite nice, in my opinion. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Marillion, the wielder of Rin

Re: Re[2]: A Split Question

2001-07-03 Thread Luke Bakken
> > >> > > > Unpack works well with fixed format data like this. NB: *fixed format* - i.e. unchanging throughout the data. > the flexibility of a regular expression. If the date style changes to, > say, 02July01 (instead of 2July2001), the regula