Compile error

2008-05-06 Thread Rodrigo Tavares
Hello, I create a hash, and i want take the keys. Using Deitel Book, i take this example: numbers = ( 1 => 'one', 3 => 'two', 5 => 'three', 7 => 'four', 9 => 'five', ); @hashkey = keys (%numbers); When I try

Writing side of square

2008-05-05 Thread Rodrigo Tavares
Hello, I need create a square using a single number, but I don't know how to create the sides. I have to create this: * * * * My code is below : print "Enter with number:"; chomp ($number = ); my @array = (); $cont = 0; while ($numero > $cont) { $array[$cont]="*";

IDE for Perl in Linux

2008-05-02 Thread Rodrigo Tavares
Hello, Today I write my perls scripts with a simple editor. I found this link http://www.enginsite.com/Perl.htm, but it run only in Windows. This link http://www.solutionsoft.com/perl.htm, contain the for linux, but have to buy. Anybody knows a simple and good IDE Perl for Linux ? By, Faria

Adding numbers of vector, in hash table

2007-10-22 Thread Rodrigo Tavares
Hello, I would like, put element's array in hash table. How I can do it ? my %numbers = ( zero => '0', one => '1', two => '2', three => '3', four => '4', five => '5', six => '6', seven => '7',

Hash receive Array

2007-10-09 Thread Rodrigo Tavares
Hello, I created a hash with some elements and keys. The hash must receive a array. Can I do it ? best regards, Faria Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento! http://br.mail.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addition

Variable $i count a lot numbers...

2007-09-01 Thread Rodrigo Tavares
Hello, I have a problem with a counter. #!/usr/bin/perl use strict; use warnings; print "Write a number:"; my $number= ; my @array; my $div = $number * 2 ; my $i=0; while ($div > 0) { $div = $div / 2; $array[$i]=$div; $i++; } print "Value i is: $i\n"; print "$array[0]\n"; prin

Open files and looking a word

2007-08-31 Thread Rodrigo Tavares
Hello, I'm doing a script, it run a ping in many computers and create a log file. I need search in log file the word "Destination Host Unreachable". So, I have to take below line. After using regular expressions taking ferrari.lab and print "The host is down !". example: PING ferrari.lab (192.

Printing asterisks in screen

2007-08-25 Thread Rodrigo Tavares
Hello, I bought a book about Programming Perl, there is a exercise : 1) Enter with a number and print asterisks (1..30) ex: if you type six have go to screen: ** See the below code : if (($num1 >= 1 && $num1 <= 30) { for (my $i=1 ; $i < 30 ; $i++) { while ($num1 == $i)

Re: Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello, I want to convert the int for string, then use the function lenght, and return the size of string. How It is possible ? Best regards, Rodrigo Faria --- Jeff Pang <[EMAIL PROTECTED]> escreveu: > 2007/8/26, Rodrigo Tavares > <[EMAIL PROTECTED]>: > > Hello Jeff,

Re: Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello Jeff, See this simple script: print "Enter with the fisrst number\n"; my $num = ; How I can to convert variable $num, in string ? Best regards, Rodrigo Faria --- Jeff Pang <[EMAIL PROTECTED]> escreveu: > 2007/8/26, Rodrigo Tavares > <[EMAIL PROTECTED]>

Convert int for string

2007-08-25 Thread Rodrigo Tavares
Hello, In many languages there is a function for convert int for string. Ho I can do it in Perl ? Best regards, Rodrigo Faria Flickr agora em português. Você clica, todo mundo vê. http://www.flickr.com.br/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
Hello John, You could explain the below line ? print join( ',', ( $arrow[ $_ ] ) x ( $_ + 1 ) ), "\n"; Thanks, Rodrigo Faria --- "John W. Krahn" <[EMAIL PROTECTED]> escreveu: > Chas Owens wrote: > > On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> > wrote: > > snip > >> Or more simply as: > >>

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
Hello John, I don't understood the line in loop for the # in variable arrow. How It can to be used ? Best regards, Rodrigo --- "John W. Krahn" <[EMAIL PROTECTED]> escreveu: > Rodrigo Tavares wrote: > > Hello, > > Hello, > > > I got make a

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
--- "John W. Krahn" <[EMAIL PROTECTED]> escreveu: > Rodrick Brown wrote: > > On 7/27/07, Rodrigo Tavares > <[EMAIL PROTECTED]> wrote: > >> > >> How I can to make this program, where the > variable is > >> enter though , how separete the d

Re: A simple program

2007-07-28 Thread Rodrigo Tavares
Hello, In my first lesson, not extist split. And without split ? There is a mode more simple ? Best regards, Rodrigo Faria --- Rodrick Brown <[EMAIL PROTECTED]> escreveu: > On 7/27/07, Rodrigo Tavares > <[EMAIL PROTECTED]> wrote: > > Hello, > > > > How I

A simple program

2007-07-27 Thread Rodrigo Tavares
Hello, How I can to make this program, where the variable is enter though , how separete the digits ? Exercice 01)Write a program than user type five digits, separates the individual digits of number, and print the five digits time five, the four digit four times, thus for ahead. Best regards,

Re: erro with Select your continent

2007-06-25 Thread Rodrigo Tavares
continents) [] 2 invalid items entered, try again Select your continent (or several nearby continents) It's vey strange ! Bye Rodrigo Farua --- Chas Owens <[EMAIL PROTECTED]> escreveu: > On 6/25/07, Rodrigo Tavares > <[EMAIL PROTECTED]> wrote: > snip > > S

erro with Select your continent

2007-06-25 Thread Rodrigo Tavares
Hello, See the log with i run perl -MCPAN -e shell: Now we need to know where your favorite CPAN sites are located. Push a few sites onto the array (just in case the first on the array won't work). If you are mirroring CPAN to your local workstation, specify a file: URL. First, pick a nearby con

Installing Dialog Module

2007-04-28 Thread Rodrigo Tavares
Hello, I try to install module dialog, but the errors messages come to screen. I don't now what's happening. see the logs : /usr/bin/perl /usr/share/perl/5.8/ExtUtils/xsubpp -typemap /usr/share/perl/5.8/ExtUtils/typemap -typemap typemap Dialog.xs > Dialog.xsc && mv Dialog.xsc Dialog.c cc -c

Dialog and Tempfiles in Perl

2007-04-11 Thread Rodrigo Tavares
Hello, I like to know, if exist anything as tempfile and dialog program in Perl. Both commands is include in shell script. I produce a software in shell-script that create new databases in postgresql, define IP Address, Port Number, set permissions, test versions, replace fields and others. And

Using regular expressions with delimitaters

2007-04-11 Thread Rodrigo Tavares
Hello, I need to use the delimiter " " , (one blank space). I read perdoc, i try to use this : if ( "8.1.8" =~ /[\d $versao \s]/) But the expression is always true. Where is the error ? my code : #!/usr/bin/perl $version=`/usr/local/pgsql/bin/pg_ctl --version`; print $version; if ( "8.1.8" =

Beginning to use the stricts and warnings

2007-04-09 Thread Rodrigo Tavares
Hello, I put in my code: use strict; use warnings; So I declared many variables. By example counters and arrays. Using my. My script start the postgres. ./postgresql.pl start|stop|reload|status I'm using this below structure. When I run the script como the message : Use of uninitialized valu

Using case in Perl

2007-04-04 Thread Rodrigo Tavares
Hello, I'm changing the script postgresq-init.sh for postgresql-init.pl. I made all perl scripts for store the database names. But my doubt is the case. In bash i have: #case $1 in # start) # $ECHO_N "Starting PostgreSQL: "$ECHO_C # su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG

Files manipulation

2007-03-27 Thread Rodrigo Tavares
Hello, What's the more fast ? 1) perl -pi -e 's/foo/bar/g' file.txt 2) open the file and make modifications In C/C++ manipulation of files are operations very weighed. Slow perfomace. Best regards, Rodrigo Faria Tavares __ Fale com seus ami

Re: Learning Perl with shells operations

2007-03-27 Thread Rodrigo Tavares
an to resolve this problem ? And How I can to use perldoc to read a directory and store your names in a array ? equal with x =`ls opt`; @word = split /\s+/, $x; I'm bash programmer, and i want learn perl. Best regards, Rodrigo Faria > On Mar 23, 10:43 am, [EMAIL PROTECTED] (Rod

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 @banco

Using Dialog in Perl

2007-03-20 Thread Rodrigo Tavares
Hello, I made a script with shell script using dialogs. I try to use the commando Dialog in a perl script. But i can't run the dialog in perl script. Can perl use windows softwares ? I belive this true. What is the software ? best regards, Rodrigo Faria

Files Operations in Pearl

2007-03-16 Thread Rodrigo Tavares
Hello, In shell-script I get a variable with command line: AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost" | awk '{print $3}' | head -n1` In C++, I use the functions read, write and others for manipulation files. And Pearl ? After I open the file, i like to get a simple word and store