Error in the compilation of vpopmail module
Hi, I'm trying to install a module from CPAN, the vpopmail.pm module. I'm running redhat 8.0 + vpopmail 5.2.1. When I run 'make' to compile the makefile created by the makefile.PL script, i receive the following error messages: vpopmail lives in: /var/vpopmail includes: -I/var/vpopmail/include libs: -L/var/vpopmail/lib -lvpopmail defs: Checking if your kit is complete... Looks good Writing Makefile for vpopmail cp vpopmail.pm blib/lib/vpopmail.pm /usr/bin/perl /usr/lib/perl5/5.8.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.0/ExtUtils/typemap -typemap typemap vpopmail.xs > vpopmail.xsc && mv vpopmail.xsc vpopmail.c Please specify prototyping behavior for vpopmail.xs (see perlxs manual) gcc -c -I/var/vpopmail/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-alias ing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -marc h=i386 -mcpu=i686 -DVERSION=\"0.08\" -DXS_VERSION=\"0.08\" -fpic "-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE" vpopmail.c In file included from vpopmail.xs:12: /var/vpopmail/include/vpopmail.h:129:13: macro "crypt" requires 2 arguments, but only 1 given In file included from vpopmail.xs:12: /var/vpopmail/include/vpopmail.h:129: `crypt' redeclared as different kind of symbol /usr/include/crypt.h:33: previous declaration of `crypt' In file included from vpopmail.xs:13: /var/vpopmail/include/vpopmail_config.h:173:1: warning: "VERSION" redefined vpopmail.c:1:1: warning: this is the location of the previous definition vpopmail.c: In function `XS_vpopmail_vauth_user': vpopmail.c:210: warning: assignment makes integer from pointer without a cast vpopmail.xs: In function `XS_vpopmail_vauth_setpw': vpopmail.xs:452: warning: assignment makes integer from pointer without a cast make: *** [vpopmail.o] Error 1 /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible How can I fix it? thank you all, - -- Bruno Negrão -- Suporte -- Plugway Acesso Internet Ltda. -- (31)34812311 -- [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing Curses.pm on Red Hat 8.0
Hi, I tried to install the Curses.pm module on my redhat linux 8.0 but I didn't compile. Does someone did it successfully? Any trick? Thank you, - -- Bruno Negrão -- Suporte -- Plugway Acesso Internet Ltda. -- (31)34812311 -- bnegrao at plugway dot com dot br -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dbmopen can't open /etc/aliases.db file
Hi, I'm triyng to open the /etc/aliases.db file for reading with the dbmopen function - the result is that I can't open the file for reading, or something like this. yes, I have permission because I'm root. My script is: #!/usr/bin/perl -w use diagnostics; dbmopen(%ALIAS,'/etc/aliases',undef) || die "No aliases!: $!"; while (($key,$value) = each(%ALIAS)) { chop($key,$value); print "$key $value\n"; } the output error is: ### Use of uninitialized value in dbmopen at ./zz line 3 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. Use of uninitialized value in null operation at ./zz line 3 (#1) Uncaught exception from user code: No aliases!: Invalid argument at ./zz line 3. Does someone could explain me why is it happening? (i'm using perl 5.6.0 and Red Hal linux 7.2) Thank you, - -- Bruno Negrão -- Suporte -- Plugway Acesso Internet Ltda. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbmopen can't open /etc/aliases.db file
Hi Michael, the problem is not with the "undef" value - undef is fine - if you read the dbmopen's documentation you could see it. If I choose a value like "0644" the script still doesn't work. Bellow, is the output of the execution of the same program, but with 0644 in place of undef: Uncaught exception from user code: No aliases!: Invalid argument at ./zz line 3. I must admit that the errors are shorter but the program still doesn't work!! Oh, hell!!! Thank you for any help, bnegrao. - Original Message - From: "Michael Kelly" <[EMAIL PROTECTED]> To: "Perl Beginners List" <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 1:04 AM Subject: Re: dbmopen can't open /etc/aliases.db file > On Thu, Sep 26, 2002 at 09:38:18PM -0300, Bruno Negrao - Perl List wrote: > > Hi, > > Hi Bruno, > > > I'm triyng to open the /etc/aliases.db file for reading with the dbmopen > > function - the result is that I can't open the file for reading, or > > something like this. yes, I have permission because I'm root. > > > > My script is: > > #!/usr/bin/perl -w > > use diagnostics; > > dbmopen(%ALIAS,'/etc/aliases',undef) || > > die "No aliases!: $!"; > > while (($key,$value) = each(%ALIAS)) { > > chop($key,$value); > > print "$key $value\n"; > > } > > Disclaimer: I've never messed around with dbmopen() before, so I can't test this > example, but seeing as nobody with more authority has answered this yet, I'll > give it a shot: > > dbmopen() expects a file permission mask (an octal number) as its third argument, > which 'undef' is not. You might try something like this as your lines 3 and 4: > > dbmopen(%ALIAS,'/etc/aliases', 0644) || > die "No aliases!: $!"; > > Even if you're sure /etc/aliases is there, that should make dbmopen() happy. > > Again, not sure if that's the answer, but it seems logical to me, > -- > Michael > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbmopen can't open /etc/aliases.db file
Thank you nkuipers for answering. I already tried declaring variables with "my", i already checked the path, i tested the hash with another name - all this doesn't make difference. To me, it seems that my /etc/aliases.db in written in a format uncompatible with the dbmopen(). I'm on the 17 chapter of the book "Learning Perl second edition" and I'm stuck in this problem. (to open the /etc/aliases.db file for reading is an exercise of the chapter 17). If somebody there has a server runing Sendmail, you have the aliases.db file too. Moreover to simply solve this exercise, i'd like to know it the dbmopen() really works with my system files. Thanks for any help, Bruno. - Original Message - From: "nkuipers" <[EMAIL PROTECTED]> To: "Bruno Negrao - Perl List" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 12:30 PM Subject: RE: dbmopen can't open /etc/aliases.db file > >Uncaught exception from user code: > >No aliases!: Invalid argument at ./zz line 3. > > Well you have three arguments. If you are *sure* that the undef is not the > problem, that leaves only two to possibly be invalid. To start, try battening > down the hatches with use strict, predeclaring your vars with my. Does using > a hash NOT called ALIAS make a difference (the implication being maybe that is > somehow a reserved identifier for hashes on your system or distro)? Are you > *sure* that the path specified in the dbmopen call is 100% correct? Dumb, > dumb questions but most problems in programming turn out to be really stupid, > and it doesn't hurt to brainstorm and try anything. > > > > > >I must admit that the errors are shorter but the program still doesn't > >work!! > >Oh, hell!!! > > > >Thank you for any help, > >bnegrao. > > > > > >- Original Message - > >From: "Michael Kelly" <[EMAIL PROTECTED]> > >To: "Perl Beginners List" <[EMAIL PROTECTED]> > >Sent: Friday, September 27, 2002 1:04 AM > >Subject: Re: dbmopen can't open /etc/aliases.db file > > > > > >> On Thu, Sep 26, 2002 at 09:38:18PM -0300, Bruno Negrao - Perl List wrote: > >> > Hi, > >> > >> Hi Bruno, > >> > >> > I'm triyng to open the /etc/aliases.db file for reading with the dbmopen > >> > function - the result is that I can't open the file for reading, or > >> > something like this. yes, I have permission because I'm root. > >> > > >> > My script is: > >> > #!/usr/bin/perl -w > >> > use diagnostics; > >> > dbmopen(%ALIAS,'/etc/aliases',undef) || > >> > die "No aliases!: $!"; > >> > while (($key,$value) = each(%ALIAS)) { > >> > chop($key,$value); > >> > print "$key $value\n"; > >> > } > >> > >> Disclaimer: I've never messed around with dbmopen() before, so I can't > >test this > >> example, but seeing as nobody with more authority has answered this yet, > >I'll > >> give it a shot: > >> > >> dbmopen() expects a file permission mask (an octal number) as its third > >argument, > >> which 'undef' is not. You might try something like this as your lines 3 > >and 4: > >> > >> dbmopen(%ALIAS,'/etc/aliases', 0644) || > >> die "No aliases!: $!"; > >> > >> Even if you're sure /etc/aliases is there, that should make dbmopen() > >happy. > >> > >> Again, not sure if that's the answer, but it seems logical to me, > >> -- > >> Michael > >> > >> -- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > >-- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbmopen can't open /etc/aliases.db file
Thank you nkuipers for answering. I already tried declaring variables with "my", i already checked the path, i tested the hash with another name - all this doesn't make difference. To me, it seems that my /etc/aliases.db in written in a format uncompatible with the dbmopen(). I'm on the 17 chapter of the book "Learning Perl second edition" and I'm stuck in this problem. (to open the /etc/aliases.db file for reading is an exercise of the chapter 17). If somebody there has a server runing Sendmail, you have the aliases.db file too. Moreover to simply solve this exercise, i'd like to know it the dbmopen() really works with my system files. Thanks for any help, Bruno. - Original Message - From: "nkuipers" <[EMAIL PROTECTED]> To: "Bruno Negrao - Perl List" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 12:30 PM Subject: RE: dbmopen can't open /etc/aliases.db file > >Uncaught exception from user code: > >No aliases!: Invalid argument at ./zz line 3. > > Well you have three arguments. If you are *sure* that the undef is not the > problem, that leaves only two to possibly be invalid. To start, try battening > down the hatches with use strict, predeclaring your vars with my. Does using > a hash NOT called ALIAS make a difference (the implication being maybe that is > somehow a reserved identifier for hashes on your system or distro)? Are you > *sure* that the path specified in the dbmopen call is 100% correct? Dumb, > dumb questions but most problems in programming turn out to be really stupid, > and it doesn't hurt to brainstorm and try anything. > > > > > >I must admit that the errors are shorter but the program still doesn't > >work!! > >Oh, hell!!! > > > >Thank you for any help, > >bnegrao. > > > > > >- Original Message - > >From: "Michael Kelly" <[EMAIL PROTECTED]> > >To: "Perl Beginners List" <[EMAIL PROTECTED]> > >Sent: Friday, September 27, 2002 1:04 AM > >Subject: Re: dbmopen can't open /etc/aliases.db file > > > > > >> On Thu, Sep 26, 2002 at 09:38:18PM -0300, Bruno Negrao - Perl List wrote: > >> > Hi, > >> > >> Hi Bruno, > >> > >> > I'm triyng to open the /etc/aliases.db file for reading with the dbmopen > >> > function - the result is that I can't open the file for reading, or > >> > something like this. yes, I have permission because I'm root. > >> > > >> > My script is: > >> > #!/usr/bin/perl -w > >> > use diagnostics; > >> > dbmopen(%ALIAS,'/etc/aliases',undef) || > >> > die "No aliases!: $!"; > >> > while (($key,$value) = each(%ALIAS)) { > >> > chop($key,$value); > >> > print "$key $value\n"; > >> > } > >> > >> Disclaimer: I've never messed around with dbmopen() before, so I can't > >test this > >> example, but seeing as nobody with more authority has answered this yet, > >I'll > >> give it a shot: > >> > >> dbmopen() expects a file permission mask (an octal number) as its third > >argument, > >> which 'undef' is not. You might try something like this as your lines 3 > >and 4: > >> > >> dbmopen(%ALIAS,'/etc/aliases', 0644) || > >> die "No aliases!: $!"; > >> > >> Even if you're sure /etc/aliases is there, that should make dbmopen() > >happy. > >> > >> Again, not sure if that's the answer, but it seems logical to me, > >> -- > >> Michael > >> > >> -- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > >-- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbmopen can't open /etc/aliases.db file
Ok david. Could you send me a code example of a database file being opened for reading with tie? thanks, bnegrao. - Original Message - From: "david" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 2:41 PM Subject: Re: dbmopen can't open /etc/aliases.db file > Bruno Negrao - Perl List wrote: > > > Hi Michael, the problem is not with the "undef" value - undef is fine - > > if you read the dbmopen's documentation you could see it. > > > > If I choose a value like "0644" the script still doesn't work. > > Bellow, is the output of the execution of the same program, but with 0644 > > in place of undef: > > > > Uncaught exception from user code: > > No aliases!: Invalid argument at ./zz line 3. > > > > I must admit that the errors are shorter but the program still doesn't > > work!! > > Oh, hell!!! > > > > the dbmopen function has been largely superseded by the "tie" function. > you shouldn't use it in the first place. > > in older version of Perl or that your system do not support DBM or ndbm, > calling dbmopen generates a fatal error and it tries the sdbm calls. > > try eval{ dbmopen(..) } and check the $@ error > > if you can, try not to use dbmopen at all, tie is better, safer and faster. > > david > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbmopen can't open /etc/aliases.db file
Yeah it worked! I simply changed the '/usr/lib/news/history' for '/etc/aliases' and the script showed the file contents. But, why? Why dbmopen didn't work? thanks, Bruno. - Original Message - From: "david" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 3:49 PM Subject: Re: dbmopen can't open /etc/aliases.db file > Bruno Negrao - Perl List wrote: > > > Ok david. > > > > Could you send me a code example of a database file being opened for > > reading with tie? > > > > thanks, > > bnegrao. > > use NDBM_File; > tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0); > while (($key,$val) = each %HIST) { > print $key, ' = ', unpack('L',$val), "\n"; > } > untie(%HIST); > > this example is directly from perldoc -f tie > > david > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: autoftp
Yes. Exist the Net::FTP module. The following text comes from the Oreilly's book "Perl in a Nutshell" 16.2 Net::FTP Net::FTP is used to transfer files from remote hosts. Using Net::FTP, you can write simple FTP clients that transfer files from remote servers based on information passed on the command line or from hard-coded variables. Here is an example of a client that connects to a remote FTP server and gets a file from the server: #!/usr/local/bin/perl -w use Net::FTP; $hostname = 'remotehost.com'; $username = 'anonymous'; $password = '[EMAIL PROTECTED]'; # Hardcode the directory and filename to get $home = '/pub'; $filename = 'TESTFILE'; # Open the connection to the host $ftp = Net::FTP->new($hostname); # construct object $ftp->login($username, $password); # log in $ftp->cwd($home),"\n"; # change directory print $ftp->ls($home),"\n"; # Now get the file and leave $ftp->get($filename); $ftp->quit; FTP clients have also been integrated with most World Wide Web browsers, using ftp:// in place of http://. When the URL points to a directory, the browser displays a listing of the directory, where each filename is a link to that file. When the URL points directly to a file, the remote file is downloaded. Here's an example that uses Net::FTP to list files from a remote FTP server on a web page, with a link from each file to the URL of the file on the remote site: #!/usr/local/bin/perl -w use Net::FTP; $hostname = 'remotehost.com'; # ftp host $username = 'anonymous';# username $password = '[EMAIL PROTECTED]'; # password $home = '/pub'; $ftp = Net::FTP->new($hostname);# Net::FTP constructor $ftp->login($username, $password); # log in w/username and password $pwd = $ftp->pwd; # get current directory # Now, output HTML page. print < Download Files Current working directory: $pwd Files to download: HTML @entries = $ftp->ls($home); # slurp all entries into an array foreach (@entries) { # now, output links for all files in the ftp area # as links print "\n"; print "ftp://$hostname$_\";>", "http://www/icons/f.gif\"; border=0>\n"; print " $_\n"; } print < HTML $ftp->quit; # end FTP session The Net::FTP module implements a subset (as shown earlier in this chapter) of the FTP protocol as defined in RFC 959. In addition to providing the methods shown below, the module inherits from Net::Cmd. Some of the Net::FTP methods return an object derived from the dataconn class (which is in turn derived from the IO::Socket::INET class), as noted in the entries for those methods. The following methods are defined by Net::FTP: new abort appe append authorize ascii binary byte cdup cwd delete dir ebcdic get list login ls mdtm mkdir nlst pasv pasv_wait pasv_xfer pasv_xfer_unique port put put_unique pwd quit quot rename retr rmdir size stor stou supported type unique_name - Original Message - From: "William Black" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 3:23 PM Subject: re: autoftp > Hello All, > > Does anyone know if perl offers an autoftp module? If they do what is it > and how does it work. > > Cheers, > > William Black > > > > _ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CGI simple but not working
Hi all, I'm studying the "Learning Perl Second Edition" and I'm learning cgi now. The book presents a sample cgi that doesn't produces the expected result as the book says it would. Could someone test it and say to me if there is something wrong? The following script was retired from the section 19.6 "Form Generation". #!/usr/bin/perl -w # cgi-bin/ice_cream: program to answer *and generate* ice cream # favorite flavor form (version 3) use CGI qw(:standard); my $favorite = param("flavor"); print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream"); if ($favorite) { print q("Your favorite flavor is $favorite."); } else { print hr, start_form; # hr() emits html horizontal rule: print q("Please select a flavor: ", textfield("flavor","mint")); print end_form, hr; } Thanks for any help, - -- Bruno Negrão -- Suporte -- Plugway Acesso Internet Ltda. -- (31)34812311 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI simple but not working
Hello Nathanael and other guys, > First of all, if possible, use the Llama 3rd, not 2nd. It's not... :-( > Second, can you give the expected output and the actual output. I tried to send the pictures to this list but my e-mail was rejected as it grew upon 5 bytes In sumary, this script should generate an one field form. But what appears in the screen are the strings inside the "q()" function. > What platform are you on, what version of perl are you using, etc? Redhat 6.2 perl version 5.005_03 built for i386-linux But i tested this script with RH7.2 v5.6.0 built for i386-linux and it doesn't work too Thanks Bruno. > Nathanael > > "Ain't no blood in my body, it's liquid soul in my veins" > ~Roots Manuva > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI simple but not working - I discovered
Hi all, the problem is that the script is really erroneous. Where you read "q(..." should be "p( ..." The p() function is a part of the CGI.pm modules and stands for a new paragraph. the right script is: #!/usr/bin/perl -w # cgi-bin/ice_cream: program to answer *and generate* ice cream # favorite flavor form (version 3) use CGI qw(:standard); my $favorite = param("flavor"); print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream"); if ($favorite) { print p("Your favorite flavor is $favorite."); } else { print hr, start_form; # hr() emits html horizontal rule: print p("Please select a flavor: ", textfield("flavor","mint")); print end_form, hr; } Thanks, bnegrao. - Original Message - From: "Bruno Negrao - Perl List" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, October 03, 2002 9:44 PM Subject: Re: CGI simple but not working > Hello Nathanael and other guys, > > First of all, if possible, use the Llama 3rd, not 2nd. > It's not... :-( > > > Second, can you give the expected output and the actual output. > I tried to send the pictures to this list but my e-mail was rejected as it > grew upon 5 bytes > In sumary, this script should generate an one field form. But what appears > in the screen are the strings inside the "q()" function. > > > What platform are you on, what version of perl are you using, etc? > Redhat 6.2 perl version 5.005_03 built for i386-linux > But i tested this script with RH7.2 v5.6.0 built for i386-linux and it > doesn't work too > > Thanks > Bruno. > > Nathanael > > > > "Ain't no blood in my body, it's liquid soul in my veins" > > ~Roots Manuva > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regular expression
> Hi Javeed , > > the last element of the array is $attt[$#attt]. If you have one line per > element, that should do it. Right. This is the easiest way. But, just to answer him, what he could do using regular expression could be something like: foreach (@attt) { /=/ && ( ($out) = (split (/=/))[1] ); } Bruno. > > R > > At 14:24 04/10/2002 +0530, Javeed SAR wrote: > > >I have the following output in array @attt > >I want the last line in a variable $out. > >What should the regular expression be? > > > > > >attribute type "SYNC_CHECK" > > created 04-Oct-02.09:36:42 by javeed.clearuser@BLRK35ED > > "for testing" > > owner: HIS\javeed > > group: HIS\clearuser > > scope: this VOB (ordinary type) > > value type: string > > Attributes: > > SYNC_CHECK = "HELLO" > > > > > >Regards > >j > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regular expression
RE: Regular expressionHi Javeed. This code: foreach (@attt) { /=/ && ( ($out) = (split (/=/))[1] ); } stores the string "HELLO" in the variable $out. Then, if you issue print "$out" you would get a "HELLO". But when I read your e-mail again I realized that you want to store the entire last line. So yoy should use this code instead: foreach (@attt) { /=/ && ( $out = $_ ); } The foreach (@attt) starts a loop storing every line of @attt in a default variable called $_ Then, if the regul. exp "/=/" matches against the default variable $_, the && statement is executed, storing the variable $_ in the variable $out. For clarifying purposes, you could write the same code as: foreach $line (@att) { if ($line =~ /=/){ $out = $line ; print "$out"; } } And if you want to get rid of the blank spaces in the last line, add try this: foreach $line (@attt) { if ($line =~ /=/){ $out = $line ; $out =~ s/\s*//; print "$out"; } } I learnt all this from the O'reilly book "Learning Perl second edition". Tied hugs and warmfull kisses, Bruno Negrão. - Original Message - From: Javeed SAR To: Bruno Negrao - Perl List Sent: Monday, October 07, 2002 1:21 AM Subject: RE: Regular expression foreach (@attt) { /=/ && ( ($out) = (split (/=/))[1] ); } Can u explain this statement to me? Which is the variable i should use for printing the output? Regards -Original Message- From: Bruno Negrao - Perl List [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 6:54 PM To: [EMAIL PROTECTED] Subject: Re: Regular expression > Hi Javeed , > > the last element of the array is $attt[$#attt]. If you have one line per > element, that should do it. Right. This is the easiest way. But, just to answer him, what he could do using regular expression could be something like: foreach (@attt) { /=/ && ( ($out) = (split (/=/))[1] ); } Bruno. > > R > > At 14:24 04/10/2002 +0530, Javeed SAR wrote: > > >I have the following output in array @attt > >I want the last line in a variable $out. > >What should the regular expression be? > > > > > >attribute type "SYNC_CHECK" > > created 04-Oct-02.09:36:42 by javeed.clearuser@BLRK35ED > > "for testing" > > owner: HIS\javeed > > group: HIS\clearuser > > scope: this VOB (ordinary type) > > value type: string > > Attributes: > > SYNC_CHECK = "HELLO" > > > > > >Regards > >j > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]