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
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
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
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
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
> 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
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
"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...
> >
> >
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
"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
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
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
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
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
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
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
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
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
> 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
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
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:/
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
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
--- 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
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
--- 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
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
--- "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
--- 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 -
> "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
> 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]
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
32 matches
Mail list logo