Re: Can't locate object method "gif" via package "GD::Image"
> > You don't say what platform or version levels you are using, > but the best bet is to upgrade to the latest gd c library from > boutell.com then install the latest Perl GD module. > http://www.boutell.com/gd/ > > Read the README that comes with the GD module... from the > Frequently Asked Questions > ## > 4. My scripts fail with "Can't locate object method 'png' via package > "GD::Image". > >libgd can now be built with support for one or more of the PNG, GIF, > XPM or >JPEG formats. If one or more of these formats are not supported by > libgd, then >the corresponding GD::Image methods will be unavailable. > Unfortunately, many >older scripts assume that the png() method will always be present. > You can >work around this issue with code like the following: > > my $image = $gd->can('png') ? $gd->png : $gd->gif; > >or if you prefer eval {} > > my $image = eval {$gd->png} || $gd->gif; > >As of libgd 2.0.33, GIF support is always compiled in, so (for the > time being!) >this is a safe fallback. > ### > > > zentara > -- > I'm not really a human, but I play one on earth. > http://zentara.net/japh.html > I have tested in RHEL 5 release ... # uname -a Linux TEST 2.6.18-36.el5 #1 SMP Fri Jul 20 14:27:44 EDT 2007 ia64 ia64 ia64 GNU/Linux I have upgraded GD to GD-2.35 version.. now its works correctly.. Thanks
Re: Can't locate object method "gif" via package "GD::Image"
> > You don't say what platform or version levels you are using, > but the best bet is to upgrade to the latest gd c library from > boutell.com then install the latest Perl GD module. > http://www.boutell.com/gd/ > > Read the README that comes with the GD module... from the > Frequently Asked Questions > ## > 4. My scripts fail with "Can't locate object method 'png' via package > "GD::Image". > >libgd can now be built with support for one or more of the PNG, GIF, > XPM or >JPEG formats. If one or more of these formats are not supported by > libgd, then >the corresponding GD::Image methods will be unavailable. > Unfortunately, many >older scripts assume that the png() method will always be present. > You can >work around this issue with code like the following: > > my $image = $gd->can('png') ? $gd->png : $gd->gif; > >or if you prefer eval {} > > my $image = eval {$gd->png} || $gd->gif; > >As of libgd 2.0.33, GIF support is always compiled in, so (for the > time being!) >this is a safe fallback. > ### > > > zentara > -- > I'm not really a human, but I play one on earth. > http://zentara.net/japh.html > I have tested in RHEL 5 release ... # uname -a Linux TEST 2.6.18-36.el5 #1 SMP Fri Jul 20 14:27:44 EDT 2007 ia64 ia64 ia64 GNU/Linux I have upgraded GD to GD-2.35 version.. now its works correctly.. Thanks
Re: delete columns csv file
John W. Krahn wrote: e-letter wrote: Readers, Hello, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: "if column headerx contains only values of 0.0e0, delete the column (including the column header). How do I start please? This may work for you: #!/usr/bin/perl use warnings; use strict; use Fcntl ':seek'; @ARGV = 'somefile.csv'; $^I = '.back'; my @headers = map 1, split /,/, <>, -1; my @keep = ( undef ) x @headers; while ( <> ) { chomp; my @fields = split /,/, $_, -1; for my $i ( 0 .. $#fields ) { $keep[ $i ] = $i if $fields[ $i ] ne '0.0e0'; } last if @headers == grep defined, @keep; That would probably be more efficient as: exit 0 if @headers == grep defined, @keep; } @keep = grep defined, @keep; seek ARGV, 0, SEEK_SET or die "Cannot seek on '$ARGV' $!"; while ( <> ) { chomp; print join( ',', ( split /,/, $_, -1 )[ @keep ] ), "\n"; } __END__ John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: delete columns csv file
e-letter wrote: Readers, Hello, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: "if column headerx contains only values of 0.0e0, delete the column (including the column header). How do I start please? This may work for you: #!/usr/bin/perl use warnings; use strict; use Fcntl ':seek'; @ARGV = 'somefile.csv'; $^I = '.back'; my @headers = map 1, split /,/, <>, -1; my @keep = ( undef ) x @headers; while ( <> ) { chomp; my @fields = split /,/, $_, -1; for my $i ( 0 .. $#fields ) { $keep[ $i ] = $i if $fields[ $i ] ne '0.0e0'; } last if @headers == grep defined, @keep; } @keep = grep defined, @keep; seek ARGV, 0, SEEK_SET or die "Cannot seek on '$ARGV' $!"; while ( <> ) { chomp; print join( ',', ( split /,/, $_, -1 )[ @keep ] ), "\n"; } __END__ John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: delete columns csv file
e-letter wrote: > > I have a csv file (greater than 256 columns hence unable to open in > spreadsheet) of the following format: > > column header1, column header2, column header3 > 1,0.0e0,0.0e0,5e-6 > 2,0.0e0,0.0e0,6e-7 > 3,0.0e0,0.0e0,0.0e0 > > I want to perform: "if column headerx contains only values of 0.0e0, > delete the column (including the column header). > > How do I start please? The Text::CSV module will be useful. I suggest you do this in two passes: run through the file once to work out which columns should be deleted, then a second time copying all but the deleted columns to an output file. Does this help get you started? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
delete columns csv file
Readers, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: "if column headerx contains only values of 0.0e0, delete the column (including the column header). How do I start please? Yours, mandriva 2008 perl 588121 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Perl Stops Processing
Jenda Krynicky wrote: > > From: inthepickle <[EMAIL PROTECTED]> > >> Really quick question. In Perl, if I open a file in notepad >> system( "notepad.exe $file" ) ; >> Perl stops processes and will not continue until I close notpad. >> How can I open the file, and have Perl continue running? > > system(1, 'notepad.exe', $file) Is that documented anywhere Jenda? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: PerlScript - FileSystemObject - Windows Scrpting Host
From: oscar gil <[EMAIL PROTECTED]> > Hello everybody, > > Can anyone tell me why this simple code does not work? > > > > > $objFSO = $WScript->CreateObject("Scripting.FileSystemObject"); > $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting); > > $objFile->WriteLine("Hello"); > > > > > > I got this error: > Error: (in cleanup) Can't call method "Writeline" on an undefined value > > I suspect something with FileSystemObject but I could not find anything on > the web and I have been searching for some days :- You would only use Scripting.FileSystemObject if you are a strong masochist. open my $OUT, '>', "test2.txt" or die "Failed to open: $^E\n"; print $OUT "Hello\n"; just like in normal Perl. And most likely the problem is permissions. The account undex which the ASP page runs doesn't have enough permissions to create the file in the current directory. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Perl Stops Processing
From: inthepickle <[EMAIL PROTECTED]> > Really quick question. In Perl, if I open a file in notepad > system( "notepad.exe $file" ) ; > Perl stops processes and will not continue until I close notpad. > How can I open the file, and have Perl continue running? system(1, 'notepad.exe', $file) Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Perl Stops Processing
inthepickle wrote: > > Really quick question. In Perl, if I open a file in notepad > system( "notepad.exe $file" ) ; > Perl stops processes and will not continue until I close notpad. > How can I open the file, and have Perl continue running? Quick question, slow answer. Perl will either spawn a shell subprocess and wait for it to complete (using the system() call as you have described) or start a process and exit (using a call to exec()). You may want to take a look at calling fork(), but starting a process from another process leaves the parent with a big responsibility, and it's more likely that your Perl program should simply complete all that it has to do and then exec "notepad $file"; when it is about to terminate. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Perl Stops Processing
http://perldoc.perl.org/functions/system.html ... the parent process waits for the child process to complete. The return value is the exit status of the program as returned by the wait call. You want to first fork and run the command in its own thread. http://perldoc.perl.org/functions/fork.html $val = fork; if ( not defined $val ) { print "Fork failed" } elsif ($val == 0) { system('notepad.exe'); exit; } ... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Perl Stops Processing
Really quick question. In Perl, if I open a file in notepad system( "notepad.exe $file" ) ; Perl stops processes and will not continue until I close notpad. How can I open the file, and have Perl continue running? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Net::SSH::Perl won't set SSH options?
Hi folks, I have a test script that remotely runs a command via SSH. The problem is that I get prompted to accept a host key if it's missing from my known_hosts file. The ssh option StrictHostKeyChecking if set to 'no' is supposed to accept a missing host key. I've tested this and it works from a command line, but I can't get the following code to do the same. (I don't think the ConnectTimeout works correctly either, FYI). Can anyone see what I'm doing wrong? Thanks! richf #!/usr/local/bin/perl use warnings; use strict; use Net::SSH::Perl; my %config = ( server => 'server', passwords => [qw(foo bar)], command=> 'who', user=> 'root', ); my $output = collect_data_over_ssh(\%config); print "\n\n", @$output, "\n\n"; sub collect_data_over_ssh { my $config = shift; my $server = $config->{server}; my $passwords = $config->{passwords}; # array ref my $command = $config->{command}; my $user= $config->{user}; my @output; my $stdout; my $stderr; my $exit; my %options = ( debug => 1, options => [ "ConnectTimeout 3", "StrictHostKeyChecking no", ], ); PASSWD: for my $pass (@$passwords) { my $ssh = Net::SSH::Perl->new($server, %options) or warn "Can't connect via SSH $!\n"; eval { $ssh->login($user, $pass); }; next PASSWD if ($@); ($stdout, $stderr, $exit) = $ssh->cmd($command); if ($stdout) { @output = $stdout; } else { @output = $stderr; } last PASSWD; } return [EMAIL PROTECTED]; }
PerlScript - FileSystemObject - Windows Scrpting Host
Hello everybody, Can anyone tell me why this simple code does not work? $objFSO = $WScript->CreateObject("Scripting.FileSystemObject"); $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting); $objFile->WriteLine("Hello"); I got this error: Error: (in cleanup) Can't call method "Writeline" on an undefined value I suspect something with FileSystemObject but I could not find anything on the web and I have been searching for some days :- ...but the same code in java or VBscript works. Any help will be really well apreciated. Thanks in advance. - You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
Net::SMTP::TLS results "EHLO command failed: 220 We do not authorize the use of this system to transport unsolicited, at cgicgi-akun.cgi line 855"
Dear my friends... I am trying to sending an e-mail with Perl::CGI. But It does not work as I expect. This is the error message: EHLO command failed: 220 We do not authorize the use of this system to transport unsolicited, at cgicgi-akun.cgi line 855 line 855 contains: $smtp = Net::SMTP::TLS->new( 'mail.penguin-teknologi.com', # may need a helo parameter here on some servers Timeout => , Debug => 0, ); What is my mistake? Please tell me. Thank you very much in advance. ps: This is the routine. #!/usr/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; use DBI; use Net::SMTP::TLS; use MIME::Base64; .. &kirimemail($mynamalengkap,$myemail,$daslink); .. sub kirimemail{ my $mymynamalengkap=shift; my $mymyemail=shift; my $mymylinknya=shift; my $mymetaemail=&metaemail($mymyemail); my $smtpserver="mail.penguin-teknologi.com"; my $smtpport=25; my $sender="MOHON JANGAN REPLY E-MAIL INI \<[EMAIL PROTECTED]>"; my $subject="Please confirm the registration for joining Online-Science.Org Community"; my $header="X-Mailer"; my $headervalue="Perl SendMail Module 1.09"; my $berkas="akun/konfir-email"; my $user="[EMAIL PROTECTED]"; my $passwd="*"; my($smtp,$mailbodydata,%mail); open(MASUKAN, "<$berkas"); while(){ s/{{NamaLengkap}}/$mymynamalengkap/g; s/{{Link-nya}}/$mymylinknya/g; s/{{emailnya}}/$mymyemail/g; $mailbodydata.=$_; } print " "; print header; print start_html("Environment"); print " "; #Keep debug off in order for web and email to both work correctly on large messages $smtp = Net::SMTP::TLS->new( 'mail.penguin-teknologi.com', # may need a helo parameter here on some servers Timeout => , Debug => 0, ); $smtp->datasend("AUTH PLAINTEXT\n"); $smtp->response(); # -- Enter sending email box address username below. We will use this to login to SMTP -- $smtp->datasend(encode_base64("$user")); $smtp->response(); # -- Enter email box address password below. We will use this to login to SMTP -- $smtp->datasend(encode_base64("$passwd")); $smtp->response(); # -- Enter email FROM below. -- $smtp->mail("$sender"); # -- Enter email TO below -- # $smtp->to("$mymetaemail"); $smtp->to("$mymyemail"); $smtp->data(); #This part creates the SMTP headers you see $smtp->datasend("To: $mymetaemail\n"); $smtp->datasend("From: $sender\n"); $smtp->datasend("Content-Type: text/html \n"); $smtp->datasend("Subject: $subject"); # line break to separate headers from message body $smtp->datasend("\n"); $smtp->datasend("$mailbodydata"); $smtp->datasend("\n"); $smtp->dataend(); $smtp->quit; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: week in a year
Jennifer G. wrote: > How do I know this day is in NO. which week in this year? > for example, Jan 1 is in the no.1 week of this year. > but how about the current day? It's a little more complicated than that. Week one is the first week in the year that has four or more days, so if Jan 1 falls on a Thursday or later it is in week 53 of the preceding year. The program below may help. Note that it assumes the first day of the week to be Sunday. Rob use strict; use warnings; use POSIX qw/mktime/; # Fetch the year and day of year for today # my ($year, $yday) = (localtime)[5, 7]; # Build a date on January 1 of the current year and get its weekday # my $jan1 = mktime(0, 0, 0, 1, 0, $year); my ($wday) = (localtime($jan1))[6]; # Calculate the number of days since the beginning of the week containing Jan 1 # If Jan 1 falls later than Wednesday then week one is a week later so subtract 7 days # The week number is the number of whole weeks since the Sunday of week 1 # $yday += $wday; $yday -= 7 if $wday > 3; my $wkno = int($yday / 7) + 1; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
locate install C code module
I had installed the Language::Prolog::Yaswi from http://search.cpan.org/~salva/Language-Prolog-Yaswi-0.14/Yaswi.pm but it is in C code implementation, normally when I install a perl module, it should be located at /usr/local/share/perl/5.8.8 but I can't see where is the Language::Prolog::Yaswi folder. Also, does anyone have the resources to understand how to link the C code with perl ? Thanks. Send instant messages to your online friends http://uk.messenger.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how to extract the last digit
[EMAIL PROTECTED] wrote: > > Thanks everyone for the help! > I get an error on 'chop' when I use the following. Why is this so? > Thanks > > use strict; > use warnings; > my @eightdecks = 1..20; > my $last = chop ($eightdecks[0] + $eightdecks[2]); > > if ($last =~ /[0-5]/){ > print "yes match.\n"; > }else{print "not match\n"}; You can only chop a variable, because the last character is removed from the target string. my $last = do { chop(my $sum = $eightdecks[0] + $eightdecks[2]); }; will do the trick. It assigns the sum to $sum and then chops $sum and returns the last character. Or, more simply, you can just write my $last = substr $eightdecks[0] + $eightdecks[2], -1; HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how to look back past hour
Richard Lee wrote: > What is the best way to indicate past hour from current time without > using a module? > > so if it's 12:00, then 11:00-12:00 > > if it's 17:30 then 16:30 to 17:30 > > if it's 00:30 then 23:30 to 00:30 > > I wrote a below program and works but there has to be a better and > easier(not sure if I want easier as I am trying to learn) but I want to > do it the right perl way(despite > perl's motto).. > > let me know please. > > #!/usr/bin/perl -w > use strict; > use diagnostics; > > my $time = localtime; > my @time_1 = split / /, $time; > my $start_time; > > for ($time_1[4]) { > if ($_ =~ /00:([0-5][0-9]:[^ ])/) { > $start_time = join(':', 23,$1); > } else { > /(.*):(.*):(.*)/; > $start_time = join(':', $1 - 1, $2,$3); > } > } > > print "$start_time to $time \n"; > > __END__ > Wed Apr 2 01:04:07 2008 Hi Richard. How about the program below. HTH, Rob use strict; use warnings; my $time = localtime; my $start_time; for ($time) { my $hms = (split)[3]; ($start_time = $hms) =~ s/(\d+)/($1 - 1) % 24/e; } print "$start_time to $time \n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: dinamic cgi with perl
I haven't learned AJAX yet (hopefully this summer), but I don't think you can do it exactly as you have envisioned. The CGI/Perl script runs on the server and produces some static HTML code which contains the AJAX. The script finishes. The HTML is sent to the browser. The browser then renders the HTML and runs any JavaScript it finds. At this point, you can prompt the user for input. (Or use plain HTML without JS and just have an HTML form.) If you are using AJAX, you can now have the JS sent the input to the server and call the script with the data. The script can generate some output that the JS would add to the webpage. The script itself can not directly ask for input. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Formbuilder - how to include other vars
Hi, The CGI::FormBuilder mailing list is down. I am hoping someone on this list might have some experience with formbuilder and could offer some guidance. I want to set some variables that I can examine within the Template. It looks like with formbuilder all the variables have to set set via the form. That's okay but I don't know how to examine any of the variables expect by looping through them... [% FOREACH field = form.fields %] [% IF field.name == 'somename' && field.value > 1 %] [% END %] [% END %] I seems excessive to have to loop through all the fields but I can't find a syntax to access a field by name directly. form.fields looks like an array and [% form.fields[0] %] gives a syntax error. Does anyone know how to either A) set a variable that would be accessible to Template or B) access a form field directly without having to loop? Sorry for being a little OT. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: dinamic cgi with perl
Hi is There some easy-understanding "how to use ajax with perl" tutorial somewhere? i just need to know how to do a cgi script to launch a prompt (javascript) and use the answer in my script please help!! pau -- Pau Marc Muñoz Torres Laboratori de Biologia Computacional Institut de Biotecnologia i Biomedicina Vicent Villar Universitat Autonoma de Barcelona E-08193 Bellaterra (Barcelona) telèfon: 93 5812807 Email : [EMAIL PROTECTED]
Re: Perl Programmer in Yorkshire, UK?
On Wed, Apr 2, 2008 at 10:56 AM, Nigel Peck <[EMAIL PROTECTED]> wrote: > > Hi all, > > I need some paid help with various Perl projects that I have going and > don't have time to write all the code. Please let me know if you're > interested or know anyone who is but you must live in Yorkshire. > > Sorry if this is the wrong list for this. snip The right place to list Perl jobs is at http://jobs.perl.org. This is a free service from the Perl community. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: sort without ignoring hyphens
LC_ALL=C sort echo.txt [EMAIL PROTECTED] wrote: On Mar 29, 3:19 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: [EMAIL PROTECTED] wrote: When I do string comparisons in perl the strings seem to ignore the embedded hyphens. I want to sort strings assuming the 'dictionary' order of the chars is ASCII order: hypen, 0-9, A-Z. It appears linux sort also has the problem (LC_ALL is blank). Any ideas? I want to avoid a brute force char by char sort if possible. Please provide an *example* of your data, what it would look like if sorted "properly", and what it actually looks like after being sorted. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall Given my data: (echo.txt) 21A 22A 2-4A 2-2A 23A 2-3A 08E 08F 08G 08GA 08H 08-J I want perl (and linux sort) to see its order as: 08-J 08E 08F 08G 08GA 08H 2-2A 2-3A 2-4A 21A 22A 23A However (on my system): 1) linux sort: sort echo.txt produces the undesired result: 08E 08F 08G 08GA 08H 08-J 21A 22A 2-2A 23A 2-3A 2-4A 2) linux sort with -n: sort -n echo.txt produces the undesired result: 2-2A 2-3A 2-4A 08E 08F 08G 08GA 08H 08-J 21A 22A 23A 3) perl's sort produces the DESIRED result perl -le'@x = qw[21A 22A 2-4A 2-2A 23A 2-3A 08E 08F 08G 08GA 08H 08- J]; print for sort @x' 08-J 08E 08F 08G 08GA 08H 2-2A 2-3A 2-4A 21A 22A 23A So, how do I write a perl script to use in place of linux sort since perl's sort produces the desired results? I want perlsort to accept input from STDIN or a filename as an argv. I don't care about any command line options since perl seems to do exactly what I desire. (I thought perl's comparisons were wrong because I used files sorted by linux sort, my mistake.) My files are significantly larger than physical memory. Any help is appreciated. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Perl Programmer in Yorkshire, UK?
Hi all, I need some paid help with various Perl projects that I have going and don't have time to write all the code. Please let me know if you're interested or know anyone who is but you must live in Yorkshire. Sorry if this is the wrong list for this. Cheers, Nigel Managing Director MIS Web Design http://www.miswebdesign.com/ MIS Web Design Limited is registered in England and Wales with company number 04561623. Our VAT Registration Number is 803-939-126. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: week in a year
Jennifer G. wrote: How do I know this day is in NO. which week in this year? for example, Jan 1 is in the no.1 week of this year. but how about the current day? It depends on how you define "week". The simple answer is: $ perl -le'print int( ( localtime )[ 7 ] / 7 )' 13 Perhaps have a look at the Date::Calc and Date::Manip modules (or many of the other Date related modules on CPAN.) John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: week in a year
If you are calculating it your self and assuming you are intrested in the ISO defenition of the week number: http://www.proesite.com/timex/wkcalc.htm Of course there are modules on CPAN that do the same but then again, if all you want to know is the number of the week it might be simpler to calculate it rather then adding a module requirement to your perl code. (depends a bit on how portable your code needs to be) Regards, Rob On Wed, Apr 2, 2008 at 2:00 PM, Jennifer G. <[EMAIL PROTECTED]> wrote: > How do I know this day is in NO. which week in this year? > for example, Jan 1 is in the no.1 week of this year. > but how about the current day? > Thanks. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > >
Can't locate object method "gif" via package "GD::Image"
Hi all, I have installed Perl-GD , and tried to use the GD::Image it throws the following error message , Can't locate object method "gif" via package "GD::Image" how can i eliminate the above error? Thanks,
week in a year
How do I know this day is in NO. which week in this year? for example, Jan 1 is in the no.1 week of this year. but how about the current day? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: how to extract the last digit
From: "sanket vaidya" <[EMAIL PROTECTED]> > You get the error on chop because anything given with chop function is > considered as string (In other words chop acts on string). So perl considers > the '+' operator you provide with chop as string rather than addition > operator.This is how your task can be accomplished. > > use warnings; > use strict; > > my @eightdecks = 1..20; > my $temp =$eightdecks[0] + $eightdecks[2]; > my $last = chop($temp); > print "Temp = $last"; > > Hope this helps. Nope. + is addition in Perl. Always. No matter the context. You get the same result with my $tmp = 1 + 2; print "result is " . $tmp . "\n"; as with print "result is " . (1 + 2) . "\n"; Perl adds the two numbers with no problem and only then if needed converts the result from a number to the string. The reason of the error message Can't modify addition (+) in chop is simple. chop() tries to modify its parameter so the parametr must be something that can be modified. It must be a "lvalue": $variable, $array[$element], $hash{'element'}, $some{more}[$complex][$structure], ... Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how to extract the last digit
From: <[EMAIL PROTECTED]> > Thanks everyone for the help! > I get an error on 'chop' when I use the following. Why is this so? > Thanks > > use strict; > use warnings; > my @eightdecks = 1..20; > my $last = chop ($eightdecks[0] + $eightdecks[2]); Because chop() attempts to modify its parameter. So it can only be called with a variable, not a more complex expression. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: how to extract the last digit
Hi You get the error on chop because anything given with chop function is considered as string (In other words chop acts on string). So perl considers the '+' operator you provide with chop as string rather than addition operator.This is how your task can be accomplished. use warnings; use strict; my @eightdecks = 1..20; my $temp =$eightdecks[0] + $eightdecks[2]; my $last = chop($temp); print "Temp = $last"; Hope this helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 1:42 PM To: beginners@perl.org Subject: Re: how to extract the last digit Thanks everyone for the help! I get an error on 'chop' when I use the following. Why is this so? Thanks use strict; use warnings; my @eightdecks = 1..20; my $last = chop ($eightdecks[0] + $eightdecks[2]); if ($last =~ /[0-5]/){ print "yes match.\n"; }else{print "not match\n"}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: simple reg ex matching
<[EMAIL PROTECTED]> wrote: > ok, I found my error, it should be as follows if I want to > match number 6:- my $_ = 62; if( $_ =~ /^6$/){ Of course you could also just use "if( $_ == 6 )". HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: simple reg ex matching
ok, I found my error, it should be as follows if I want to match number 6:- my $_ = 62; if( $_ =~ /^6$/){ - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Wednesday, April 02, 2008 5:07 PM Subject: simple reg ex matching Hi, The value of $_ is 62. In the script below, I just wonder why the default variable match the number 6. What I wanted to say is that if the default variable $_ holding the value of 62, if match the number 6, then print Yes match. So what is the right way to right. Thanks use strict; use warnings; my $_ = 62; if( $_ =~ /6/){ print "Yes match \n"; }else{print "no"}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: how to write 0 to 10 in reg exp.
Here is the code to match 0 to 10 using regex. use warnings; use strict; print "Enter any number:"; my $input = ; chomp($input); if($input=~ m/^10$|^[0-9]$/) { print "matched"; } else { print "not matched"; } Hope it helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 2:09 PM To: beginners@perl.org Subject: how to write 0 to 10 in reg exp. Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print "Yes match\n"; }else{print "no"}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
simple reg ex matching
Hi, The value of $_ is 62. In the script below, I just wonder why the default variable match the number 6. What I wanted to say is that if the default variable $_ holding the value of 62, if match the number 6, then print Yes match. So what is the right way to right. Thanks use strict; use warnings; my $_ = 62; if( $_ =~ /6/){ print "Yes match \n"; }else{print "no"};
Re: how to write 0 to 10 in reg exp.
try this one: # perl -Mstrict -le 'my $x=shift; print 1 if $x=~/^[0-9]$|^10$/' 10 1 On 4/2/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > How do I write the expression, if the variable match between 0 to 10? Below > is the wrong expression I wrote which is suppose to be if $eightdecks match 0 > to 10. So i want the answer to be yes. > Thanks > > my $eightdecks = 6; > > if($eightdecks =~ /[0-10]/){ > print "Yes match\n"; > }else{print "no"}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
how to write 0 to 10 in reg exp.
Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print "Yes match\n"; }else{print "no"};
Re: how to extract the last digit
Thanks everyone for the help! I get an error on 'chop' when I use the following. Why is this so? Thanks use strict; use warnings; my @eightdecks = 1..20; my $last = chop ($eightdecks[0] + $eightdecks[2]); if ($last =~ /[0-5]/){ print "yes match.\n"; }else{print "not match\n"}; - Original Message - From: "John W. Krahn" <[EMAIL PROTECTED]> To: "Perl Beginners" Sent: Wednesday, April 02, 2008 12:06 AM Subject: Re: how to extract the last digit [EMAIL PROTECTED] wrote: Hi, Hello, How do I extract the last digit of a number? example I only want the digit 9 from the number 19. my $number = 19; my $last_digit = chop $number; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order.-- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/