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: 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-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-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 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 Timothy Johnson
Something like this should work: if($_ =~ /.*split(.*)/){ print "Here's the end: $1\n"; }else{ print "Couldn't find the split word!\n"; } or my($beginning,$end) = split(/split/,$sentence); print "Here's the end: $end\n"; -Original Message- From: jdavis [mail

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

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: 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-29 Thread Abdulaziz Ghuloum
Hello, You can do it in one line like: my $str = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"'; %hash = $str =~ /DimView\s+(\d+)\s+("[^"]*")\s+/g; print "$_ $hash{$_}\n" for keys %hash; Aziz,,, On Thu, 28 Jun 2001 16:32:28 -0400, Seitz, Scott said: > I'm having

RE: Simple Split Question

2001-06-29 Thread Stephen Nelson
I don't think you want to use split.. at least I wouldn't. I would do: my %foo = (); my $line = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"'; $foo{$1} = $2 while $line =~ m/DimView (\d) "([^"]+)"/g; That gives me %foo as (according to Data::Dumper): {

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" DimView 4 "None" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "N

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" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "None") >

Re: Simple Split Question

2001-06-29 Thread Ken
Well, the reason it's not working is that there is only one Dimview between pairs, for a hash you need seperators between all elements. Here's a way to do it, although I bet others can come up with a quicker/more efficient way: my (%hash); $_ = 'DimView 1 "All" DimView 2 "Some" DimView 3 "Most"