Window for Video output...
Hello, I am trying to make a wmdock.app (64x64 pixel) and I have the need for a function which open a window which show the captured output of a Video- Telephonie stream of a GSM-Modem. Now my question: Is there a perl lib which can do such stuff? The window should contain only the Video and controled by the wmdock.app. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
XML::Simple Environment errors
Hello all We recently migrated over to a new server and installed the new version of XML::Simple and am getting errors when I try to parse an XML file. I get an error stating: XMLin() requires either XML::SAX or XML::Parser I have verified that both modules are installed. What is strange is when I try to get the version of XML::Parser or XML::SAX I get the following error: bash-3.2$ perl -mXML::Parser -e 'print $XML::Parser::VERSION' Can't load '/usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/auto/XML/Parser/Expat /Expat.so' for module XML::Parser::Expat: ld.so.1: perl: fatal: libgcc_s.so.1: open failed: No such file or directory at /usr/local/lib/perl5/5.8.8/sun4-solaris/DynaLoader.pm line 230. at /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/XML/Parser.pm line 14 Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/XML/Parser.pm line 14. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/XML/Parser.pm line 18. Compilation failed in require. I have verified that the file is there and that the modules were installed. I thought I got around this by fixing my library path by explicitly setting the LIBRARY PATH to usr/local/lib, but when I do this - I lose the path to my other modules that I use, such as DBD, etc. On our old server, when I try to get the version of XML::Parser or XML::SAX I do not receive any errors. I am under the assumption it is an environment setting. Unfortunately I am not the admin of the machine, so I did not install the modules Can anyone point me to a solution? Thanks in advance. Robert Gorrebeeck Sr. EDI Developer TCM Development Group 3220 Keller Springs Suite #106 Carrollton, Texas 75006 (o) (972) 725-1484 (e) [EMAIL PROTECTED] Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA). The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.
Read File Problem
Hello I am trying to read a text file with carriage returns and line feeds on a unix system and for some reason it will read only one of text. I use the same code in a different perl script and I can read a file that does not have carriage returns and line feeds. The existing code is : open (SOURCE_FILE,$source_file) or die; $_ = SOURCE_FILE; How can I get the read line to read the entire file? Thanks, Andrew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Read File Problem
[EMAIL PROTECTED] wrote: I am trying to read a text file with carriage returns and line feeds on a unix system and for some reason it will read only one of text. I use the same code in a different perl script and I can read a file that does not have carriage returns and line feeds. The existing code is : open (SOURCE_FILE,$source_file) or die; $_ = SOURCE_FILE; How can I get the read line to read the entire file? If you want the entire contents of the file in one scalar variables you should write: my $contents = do { open my $fh, $source_file or die $!; local $/; $fh; }; The line local $/; resets the input record separator so that the file isn't split up into lines. You should read non-text (binary) files this way as well, as there is a chance that a binary file may have line-feed characters in it and you could read only part of the file when you think you have it all. It is often better to read and process a text file line by line, so that your program doesn't take up large amounts of memory unnecessarily. Also, if your file is small, it can be easier to handle if you read it into an array instead of a scalar, with one record per array element. You should consider these possibilities with your application. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Request for advice/suggestions....
I'm very new with PERL and have been given a task of doing some maint. on an existing really big PERL program. What I'd like to ask is if the changes I want to implement will work and ask for suggestions on how to make one major change working with subroutines. The application makes use of a number of arrays that contain categories and subcategories. What I'd like to do is to move these into a separate file (extras.pl) and reference it with a require. These structures were in the mainline program. Adding new categories involved editing the mainline code, so my thought was it would be easier and less trouble- prone to put them in a separate file to which new ones could be added easily. What I want to add to the external required file are these objects. Can I do this pretty transparently and easily? Will I run into any serious problems by moving them to a separate file? use vars qw(%config %category %paper %records); %category = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); %paper = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', ); %records = ( r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); -- Secondly, when additional categories are added, the program is coded such that a new subroutine has to be inserted dealing with that category. For example, there would be a subroutine added for paper and one for records. In each subroutine there are only 3 references to the item. For example, in the paper subroutine there are only these 3 places where paper stuff is mentioned. Sample is below (with non-relevant code removed). So, if we had 10 categories there would be ten subroutines - one for each category - differing only in the 3 places where the category topic is mentioned. My question - is it possible to create only one generic subroutine that could have the topic name plugged in rather than having ten almost-alike subroutines? If so, can you recommend a sample code snippet that I can model the procedure after? These subroutines are accessed by : elsif ($form{'action'} eq 'paper') { paper; } #Paper Items Category elsif ($form{'action'} eq 'records') { records; } #Records Category sub paper { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Paper Categories/font/b/td/tr; my $key; foreach $key (sort keys %paper) { }} sub records { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Records Categories/font/b/td/tr; my $key; foreach $key (sort keys %records) { }} Thanks for your suggestions, ideas, comments, etc. Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message.
PAR packer Error
Hello, I am trying to make an exe file from a perl script file. I am using ActiveState Perl 5.8.6 (Build 811) on Windows. This is the lcommand that i am running and the error msg: pp -o sp.exe spdisplaye.pl Perl lib version (v5.8.6) doesn't match executable version (v5.8.8) at C:/Perl/ ib/Config.pm line 32. Compilation failed in require at C:/Perl/lib/DynaLoader.pm line 25. BEGIN failed--compilation aborted at C:/Perl/lib/DynaLoader.pm line 25. Compilation failed in require at C:/Perl/site/lib/Compress/Zlib.pm line 15. Compilation failed in require at C:/Perl/site/lib/Archive/Zip.pm line 11. BEGIN failed--compilation aborted at C:/Perl/site/lib/Archive/Zip.pm line 11. Compilation failed in require at -e line 406. C:\Perl\Bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to fi e 'parlHk8jbV7.exe' at C:/Perl/site/lib/PAR/Packer.pm line 1149, DATA line 1. i am using PAR 0.976 i will be happy to find solution for thi problem as i am trying to solve it for more then 10 hours.. Thanks, Roi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Request for advice/suggestions....
[EMAIL PROTECTED] wrote: I'm very new with PERL and have been given a task of doing some maint. on an existing really big PERL program. What I'd like to ask is if the changes I want to implement will work and ask for suggestions on how to make one major change working with subroutines. The application makes use of a number of arrays that contain categories and subcategories. What I'd like to do is to move these into a separate file (extras.pl) and reference it with a require. These structures were in the mainline program. Adding new categories involved editing the mainline code, so my thought was it would be easier and less trouble- prone to put them in a separate file to which new ones could be added easily. What I want to add to the external required file are these objects. Can I do this pretty transparently and easily? Will I run into any serious problems by moving them to a separate file? use vars qw(%config %category %paper %records); %category = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); %paper = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', ); %records = ( r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); Secondly, when additional categories are added, the program is coded such that a new subroutine has to be inserted dealing with that category. For example, there would be a subroutine added for paper and one for records. In each subroutine there are only 3 references to the item. For example, in the paper subroutine there are only these 3 places where paper stuff is mentioned. Sample is below (with non-relevant code removed). So, if we had 10 categories there would be ten subroutines - one for each category - differing only in the 3 places where the category topic is mentioned. My question - is it possible to create only one generic subroutine that could have the topic name plugged in rather than having ten almost-alike subroutines? If so, can you recommend a sample code snippet that I can model the procedure after? These subroutines are accessed by : elsif ($form{'action'} eq 'paper') { paper; } #Paper Items Category elsif ($form{'action'} eq 'records') { records; } #Records Category sub paper { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Paper Categories/font/b/td/tr; my $key; foreach $key (sort keys %paper) { }} sub records { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Records Categories/font/b/td/tr; my $key; foreach $key (sort keys %records) { }} I recommend that you modularize this and write a Categories.pm file that defines the data, and then access it with use Categories; in your main code. It would be nice if you could make this a bit object-oriented and make the hashes private to the Categories module, with exported subroutines that let the main code do what it wanted with them. But without seeing how your program is structured I can't say whether that's feasible or not. Your module would look like this. As it seemed that %category was just an amalgamation of %paper and %records I've written it that way. package Categories; use strict; use warnings; require Exporter; our @ISA = qw/Exporter/; our (%config, %category, %paper, %records); our @EXPORT = qw(%config %category %paper %records); %paper = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', ); %records = ( r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); %category = (%paper, %records); 1; As for generalizing your category subroutines, again a lot depends on the scope of the data and subroutines involved ( chkclose(), for instance, and anything else you've edited out. But you could write something like this. sub _process_category { my ($hash, $text) = @_; chkclose(); print HTML; p align=center b font
perl2exe
Hello I am using perl2exe (Oct 27, 2001) and it works fine for little script without several .pm and it does good binary conversion. I am working without any install of perl8.8 or 10. Now I want to include Win32::process which includes others dependencies and I would like to know if I can continue using perl2exe and install perl 10. How can I include all .pm easily with the install of perl 10 and perl2exe is it compatible ? Thanks Best Regards Epanda -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Request for advice/suggestions....
Outstanding! I need to think about this a bit but it looks exactly like what I want to do. Thank you for your suggestions and ideas! -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2008 3:46 PM To: beginners@perl.org Cc: Copits Dick Subject: Re: Request for advice/suggestions [EMAIL PROTECTED] wrote: I'm very new with PERL and have been given a task of doing some maint. on an existing really big PERL program. What I'd like to ask is if the changes I want to implement will work and ask for suggestions on how to make one major change working with subroutines. The application makes use of a number of arrays that contain categories and subcategories. What I'd like to do is to move these into a separate file (extras.pl) and reference it with a require. These structures were in the mainline program. Adding new categories involved editing the mainline code, so my thought was it would be easier and less trouble- prone to put them in a separate file to which new ones could be added easily. What I want to add to the external required file are these objects. Can I do this pretty transparently and easily? Will I run into any serious problems by moving them to a separate file? use vars qw(%config %category %paper %records); %category = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); %paper = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', ); %records = ( r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); Secondly, when additional categories are added, the program is coded such that a new subroutine has to be inserted dealing with that category. For example, there would be a subroutine added for paper and one for records. In each subroutine there are only 3 references to the item. For example, in the paper subroutine there are only these 3 places where paper stuff is mentioned. Sample is below (with non-relevant code removed). So, if we had 10 categories there would be ten subroutines - one for each category - differing only in the 3 places where the category topic is mentioned. My question - is it possible to create only one generic subroutine that could have the topic name plugged in rather than having ten almost-alike subroutines? If so, can you recommend a sample code snippet that I can model the procedure after? These subroutines are accessed by : elsif ($form{'action'} eq 'paper') { paper; } #Paper Items Category elsif ($form{'action'} eq 'records') { records; } #Records Category sub paper { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Paper Categories/font/b/td/tr; my $key; foreach $key (sort keys %paper) { }} sub records { chkclose; print p align=centerbfont color=$config{'colortablebody'} face=Arial size=2Records Categories/font/b/td/tr; my $key; foreach $key (sort keys %records) { }} I recommend that you modularize this and write a Categories.pm file that defines the data, and then access it with use Categories; in your main code. It would be nice if you could make this a bit object-oriented and make the hashes private to the Categories module, with exported subroutines that let the main code do what it wanted with them. But without seeing how your program is structured I can't say whether that's feasible or not. Your module would look like this. As it seemed that %category was just an amalgamation of %paper and %records I've written it that way. package Categories; use strict; use warnings; require Exporter; our @ISA = qw/Exporter/; our (%config, %category, %paper, %records); our @EXPORT = qw(%config %category %paper %records); %paper = ( p01 = 'PAPER ITEMS GENERAL', p02 = 'Diaries and Journals', p03 = 'Indentures', p04 = 'Letters', p05 = 'Certificates', p10 = 'Other Paper Items', ); %records = ( r01 = 'RECORDS GENERAL', r02 = 'Birth and Death', r03 = 'Marriage ', r04 = 'Wills ', r05 = 'Census', r06 = 'Court and Probate', r07 = 'Immigration and Ship Lists', r08 = 'Military', r09 = 'Maps', r10 = 'Other Records', ); %category = (%paper, %records); 1; As for generalizing your category
Re: PAR packer Error
Roi wrote: I am trying to make an exe file from a perl script file. I am using ActiveState Perl 5.8.6 (Build 811) on Windows. This is the lcommand that i am running and the error msg: pp -o sp.exe spdisplaye.pl Perl lib version (v5.8.6) doesn't match executable version (v5.8.8) at C:/Perl/ ib/Config.pm line 32. Compilation failed in require at C:/Perl/lib/DynaLoader.pm line 25. BEGIN failed--compilation aborted at C:/Perl/lib/DynaLoader.pm line 25. Compilation failed in require at C:/Perl/site/lib/Compress/Zlib.pm line 15. Compilation failed in require at C:/Perl/site/lib/Archive/Zip.pm line 11. BEGIN failed--compilation aborted at C:/Perl/site/lib/Archive/Zip.pm line 11. Compilation failed in require at -e line 406. C:\Perl\Bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to fi e 'parlHk8jbV7.exe' at C:/Perl/site/lib/PAR/Packer.pm line 1149, DATA line 1. i am using PAR 0.976 i will be happy to find solution for thi problem as i am trying to solve it for more then 10 hours.. It looks as though you have ActivePerl 5.8.8 partially installed, as your library files are more recent than the perl build itself. Either that or you have two installations of perl and the wrong one is found in PATH. You need to sort out what you have on your machine. It may be as simple as downloading an installation package for v5.8.8 and installing it properly. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: perl2exe
epanda wrote: I am using perl2exe (Oct 27, 2001) and it works fine for little script without several .pm and it does good binary conversion. I am working without any install of perl8.8 or 10. Now I want to include Win32::process which includes others dependencies and I would like to know if I can continue using perl2exe and install perl 10. How can I include all .pm easily with the install of perl 10 and perl2exe is it compatible ? You need to install a different version of perl2exe to build images that use Perl 5.10. You should install Perl 5.10 on your PC as well as the relevant modules for your program. Once you have tested it thoroughly under the perl interpreter you can use perl2exe to build an executable image. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Read File Problem
[EMAIL PROTECTED] wrote: How can I get the read line to read the entire file? That's a FAQ. perldoc -q entire file -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
How to convert the date ?
we have string of date 2005-11-01 and want to display as November 1, 2005 THanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: How to convert the date ?
The Date::Format and Date::Parse Modules are useful for manipulate dates yuo can see the documentation of this modules on http://search.cpan.org On Wed, Jul 23, 2008 at 5:28 PM, cc96ai [EMAIL PROTECTED] wrote: we have string of date 2005-11-01 and want to display as November 1, 2005 THanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- David Romero www.factufacil.com.mx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
searching keys
Hi there, I loaded a bunch of configuration lines into a hash called $Input now I am searching the hash to make sure specific lines are there. I want to print NO unless there is a match to the following check $ip here; but $ip could be the range as shown below. so a key like check 2.2.2.2 here would be accepted and NO would *not* be printed and if the hash has a key with check 2 here then a NO *would* be printed. my $ip = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+; print CHANGE NO\n unless exists $Input{check $ip here}; Cheers, Noah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: searching keys
On Thu, Jul 24, 2008 at 3:59 AM, Noah [EMAIL PROTECTED] wrote: Hi there, I loaded a bunch of configuration lines into a hash called $Input now I am searching the hash to make sure specific lines are there. I want to print NO unless there is a match to the following check $ip here; but $ip could be the range as shown below. so a key like check 2.2.2.2 here would be accepted and NO would *not* be printed and if the hash has a key with check 2 here then a NO *would* be printed. my $ip = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+; print CHANGE NO\n unless exists $Input{check $ip here}; Cheers, Noah Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; # Use variables for filehandles. open my $CHANGE, $changeFile or die; print CHANGE NO\n unless ( grep ( $ipSearch, @lines ) ); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: searching keys
Noah Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; # Use variables for filehandles. open my $CHANGE, $changeFile or die; print CHANGE NO\n unless ( grep ( $ipSearch, @lines ) ); Hi there, okay I have a strange issue. all the lines as part of my @lines = keys %ip; have a space at the beginning of the line of each key. cheers, Noah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: searching keys
yitzle wrote Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; # Use variables for filehandles. open my $CHANGE, $changeFile or die; print CHANGE NO\n unless ( grep ( $ipSearch, @lines ) ); Hi there, okay I am trying to figure this out. when I perform the following: there is a space at the beginning of each line printed: print @lines; there is no space at the beginning of the line: for $line (@lines) { print $line; } Cheers, Noah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: searching keys
Untested code. # Always... use strict; use warnings; my %ip = ...; #Get the lines as an array. my @lines = keys %ip; # Slight modification to the regex. Someone else's reply will probably have a more elegant method. my $ipSearch = qr/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; # Use variables for filehandles. open my $CHANGE, $changeFile or die; print CHANGE NO\n unless ( grep ( $ipSearch, @lines ) ); Sorry for all the emails. Here is another thing I have a question about. is there a cleaner way to perform the following: my @lines = keys(%Input); print CHANGE *** NO blah\n unless ( grep (blah, @lines) ); print CHANGE *** NO blah2\n unless ( grep (blah2 $any_ipaddress, @lines) ); print CHANGE *** NO blah3\n unless ( grep (blah3, @lines) ); print CHANGE *** NO blah4\n unless ( grep (blah4 $some_pattern, @lines) ); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Diamond operator and quoted word?
I watched Dr. Damian Conway's speech on OSCON 2008 movie clip. And I saw unfamiliar syntax. I know quoted words... my @list = qwword1 word2 word3 ... ; and I know @ARGV or filehandle with diamond operator... my @lines = $fh; my $one_line = ; But this expression is very suprising... my @list = word1 word2 word3 word4; Would anybody please explain about that syntax or give me an reference link to study? Thanks, Regrads, Keedi Kim
Difference between = and = in Perl !
Hi all, I could be a very basic question but I am unable to find any answers on internet. What's the difference between = and = in Perl ? To the best of my knowledge, = means greater than or equal to and = is just used instead of comma to distinguish between key and values while assigning a hash. I am unable to justify the output of the following program (for = operator) $ cat y.pl #! /usr/bin/perl use warnings; use strict; my $i = 6; if ($i = 5) { print \nInside If; } else { print \nInside Else; } print \n===; if ($i = 5) { print \nInside If; } else { print \nInside Else; } print \n; $ perl y.pl Useless use of private variable in void context at y.pl line 26. Inside If === Inside If [EMAIL PROTECTED]:~]$ Thanks Regards Amit Saxena