Re: Searching in a line



On Aug 30, 12:14 am, Peter Makholm <pe...@xxxxxxxxxxx> wrote:
lerameur <leram...@xxxxxxxxx> writes:
Hi
either way I am getting these error messages:
./spam2: my: command not found
./spam2: line 6: unexpected EOF while looking for matching `"'
./spam2: line 10: syntax error: unexpected end of file

Looks like you're trying to use bash af perl interpreter. That
wouldn't work. Did you forgot the #!-line?

//Makholm

Thanks fo ryour help

I re-wrote the program like you said without #! line.. Doh

here your/my program: (the file.txt file i sin the same directory with
two lines)
12,45,7,435,435,42342,2432;
243,454,324,45,2,4;
~

the program :

#!/usr/bin/perl

my $log = 'file.txt';
open my $fh, '<', $log or die "cannot open '$log': $!\n";
while (<$fh>) {

my $val =(split( /,/,$log))[3]
print $val, "\n";

}
close $fh;

getting compilation error.
New to perl, different then C and Basic

.



Relevant Pages

  • bash quandry
    ... when run, gives these error messages: ... at the command line, ... gives: bash: syntax error near unexpected token `done' ...
    (Fedora)
  • Re: bash quandry
    ... when run, gives these error messages: ... at the command line, ... gives: bash: syntax error near unexpected token `;' ... The syntax in the bash man page is: ...
    (Fedora)
  • Re: Searching in a line
    ... either way I am getting these error messages: ... ./spam2: my: command not found ... Looks like you're trying to use bash af perl interpreter. ...
    (comp.lang.perl.misc)
  • Re: Searching in a line
    ... either way I am getting these error messages: ... ./spam2: my: command not found ... Looks like you're trying to use bash af perl interpreter. ...
    (comp.lang.perl.misc)
  • Re: Searching in a line
    ... either way I am getting these error messages: ... ./spam2: my: command not found ... Looks like you're trying to use bash af perl interpreter. ...
    (comp.lang.perl.misc)