Re: Searching in a line



Jürgen Exner wrote:
lerameur wrote:
On Aug 29, 5:25 pm, "Jürgen Exner" <jurge...@xxxxxxxxxxx> wrote:
lerameur wrote:
I want to do a search in a log file. each line has the following
pattern:
34,56,,9,0,0,,,,65;
So there 10 section. How do I parse through different sections?

Ok, ok, that split() syntax is not correct, I forgot to specify the
pattern. If you had included a self-contained minimal program then I
could have tested my suggestion and that would not have happened.

Here's the spoonfed version:

my $foo = '34,56,,9,0,0,,,,65';
my $bar = (split(/,/,$foo))[3];
print $bar;

jue


.



Relevant Pages

  • Re: [ANN] Chronic-0.1.0
    ... See below for the wide variety of formats Chronic will parse. ... I've been wrestling with that concept for ... awhile not in a OS X Dashboard clock I made. ... Which matches a pattern that knows to look for the next future January, and beginning with the start of that month, look for the next future Tuesday three times. ...
    (comp.lang.ruby)
  • Re: match string by re using some pattern
    ... [huge snip] ... for instance we parse http web page ... It isn't a pattern as far as ... #$price -> MUSIC ...
    (comp.lang.perl.misc)
  • Please help, Im a newb at perl and I cant figure this out.
    ... Basically I want to parse some C++ source code and replace some ... So I need a pattern that will match only the first " of every ... Alex ...
    (comp.lang.perl)
  • Re: Which design pattern is good for this?
    ... design pattern? ... a better pattern is DRY: ... and then just keep calling Parse etc. Sounds ... if you're going to try to parse something ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Searching in a line
    ... perldoc -f split ... Ok, ok, that splitsyntax is not correct, I forgot to specify the pattern. ... If you had included a self-contained minimal program then I could have ... As for the other error messages: you didn't show us your program, ...
    (comp.lang.perl.misc)