Re: Learning Perl with shells operations

2007-03-28 Thread Alan
On Tuesday 27 March 2007 06:47, Rodrigo Tavares wrote: Hello, [ . . ] I use of stricts and warnings, and come this error compilation when i wrote into my code. Global symbol $x requires explicit package name at ./start-banco.pl line 7. Global symbol @word requires explicit package name at

Re: Learning Perl with shells operations

2007-03-28 Thread Rob Dixon
Rodrigo Tavares wrote: Hello, With this line the script run, no errors. system su postgres -c '/usr/local/pgsql/bin/pg_ctl start -D /opt/@bancos[$i]'; two things : I use of stricts and warnings, and come this error compilation when i wrote into my code. Global symbol $x requires explicit

Re: Learning Perl with shells operations

2007-03-27 Thread Rodrigo Tavares
Hello, With this line the script run, no errors. system su postgres -c '/usr/local/pgsql/bin/pg_ctl start -D /opt/@bancos[$i]'; two things : I use of stricts and warnings, and come this error compilation when i wrote into my code. Global symbol $x requires explicit package name at

Learning Perl with shells operations

2007-03-23 Thread Rodrigo Tavares
Hello, My code is below: $aux = `ls /opt`; @word = split /\s+/, $aux; my @bancos = (); foreach my $i (@word) { if ( -e /opt/$i/postgresql.conf ) { push(@bancos,$i); } } for ($i = 0; $i @bancos; $i++) { su postgres -c /usr/local/pgsql/bin/pg_ctl start -D

Re: Learning Perl with shells operations

2007-03-23 Thread Jeff Pang
Hello, $aux = `ls /opt`; This is not good since Perl has built-in function for read a dir. see: perldoc -f opendir perldoc -f readdir su postgres -c /usr/local/pgsql/bin/pg_ctl start -D @bancos[$i]; 'su' is not Perl's function.This is a unix shell command,you need to call it with

Re: Learning Perl with shells operations

2007-03-23 Thread John W. Krahn
Rodrigo Tavares wrote: Hello, Hello, My code is below: $aux = `ls /opt`; @word = split /\s+/, $aux; That won't work very well if you have names with embeded spaces. A better option would be to assign the back-quote results to an array. my @bancos = (); Why are you assigning nothing