- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 35
- Posts with Upvotes
- 29
- Upvoting Members
- 13
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Working with Perl for over 15 years.
- PC Specs
- Working on Windows now (dang!)
148 Posted Topics
It's been a long while since I've been here. I am trying to use Win32 IEAutomation to automate IE to login to SharePoint, read some information, download some files and some other junk. I installed WIN32 IEAutomation. When I run the simple script: use Win32::IEAutomation; my $ie = Win32::IEAutomation->new( visible … | |
Re: It appears to want to connect to an IRC channel and send info to that. | |
Re: IMO it's best to use an array of hashes. Here is a version that works for what you wish. The hashes are put into an array, so each hash is in an array row: [CODE] use strict; use warnings; open(FILE,"<source.txt"); my $x=0; my @keys; my @holder; my @array_hash; while(<FILE>){ chomp; … | |
Re: There is no "use Mysql". You have to connect to MySQL through DBI/DBD:Mysql. Since you're on windows, you will want to include the uwinnipeg ppm server in your ppm manager. It depends on the version of perl you are running. Go to the command prompt and type perl -v. to … | |
Re: [CODE]Use DBI and DBD::MySQL[/CODE] [url]http://search.cpan.org/~capttofu/DBD-mysql-4.020/lib/DBD/mysql.pm[/url] [url]http://search.cpan.org/~timb/DBI-1.616/DBI.pm[/url] | |
Re: What error message are you getting? The code runs fine on my Windows PC. I didn't have TK installed so I ran: [CODE] ppm install Tk [/CODE] And it installed fine. Then the thing ran fine. BTW, the first line doesn't mean anything in Windows. Windows ignores it. It's only … ![]() | |
Re: print out [iCODE]$ENV{HTTP_COOKIE}[/iCODE] on the page some where. | |
Re: It is by default set to newline (\n). But if you undef it, you can slurp in an entire file or data set. [CODE] use strict; use warnings; undef($/); my $fulltext; while(<DATA>){ $fulltext=$_; } $/="\n"; print "$fulltext\n"; __DATA__ Alice was beginning to get very tired of sitting by her sister … | |
Re: Why are you doing this? Why not use [iCODE]use Net::SMTP;[/iCODE]. It's a heck of a lot easier than this and it has a debug mode. [url]http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm[/url] | |
Re: This doesn't make any sense. When you say "an unknown number of keys" what are you talking about? I mean: $hash{$key}=$value; Why would you need a push? | |
Re: [url]http://search.cpan.org/~gbarr/Convert-ASN1-0.22/lib/Convert/ASN1.pod[/url] [QUOTE=deepakkrish;1491417]Hi Friends, I got an ASN.1 file .I need to convert it to readable format.is there any way. Thanks in advance, Deepak[/QUOTE] | |
Re: Reset the cookie to an invalid value. | |
Re: Do you have the DBD driver for MySQL installed? Also, can you run a script from teh command line that accesses the database? Can you run that specific cgi script from teh command line as the web server user? | |
Re: It sets scope: [CODE] my $var1="world"; { my $var1="hello"; print "$var1 "; } print "$var1\n"; [/CODE] Output: [CODE] hello world [/CODE] | |
Re: Try this: [CODE] use strict; use warnings; open (OUT, ">newfile.txt"); while(<DATA>){ chomp; my ($time,$rest)=split(/ --/,$_,2); my ($hours,$mins,$secs,$usec)=split(/\-/,$time); $hours=~s/^LT//; my $newsec=$hours*3600+$mins*60+$secs; print OUT "LT$newsec --$rest\n"; } close OUT; __DATA__ LT19-10-13-400922 --TID1-3039 1--RequestREGISTER LT19-10-13-405432 --TID1-3039 1--Response100 LT19-10-13-410015 --TID1-3039 1--Response401 LT19-10-13-415481 --TID1-3039 2--RequestREGISTER LT19-10-13-419800 --TID1-3039 2--Response100 [/CODE] The DATA section can be read … | |
Re: What user does the crontab run as? Does it have the rights to read that file? | |
Re: Here you go... [CODE] use strict; use warnings; my @array=<DATA>; my $x; for (@array){ chomp; $x++; if(/\<\!\-\-addsearch\-\-\>/){ my @hold; my $count=(@hold)=$_=~/\"/g; if($count>=2){ print "yep line # $x: $_\n"; } } } __DATA__ <html> <body> a line <br> another" with one quote <!--addsearch--> yet one more "and another" <!--addsearch--> not this … | |
Re: It can be solved, yes. One question for you is - when you say "holds the latest file" do you mean the file name or the file contents? | |
Re: Sure use: [CODE]use Text::CSV;[/CODE] | |
Re: [CODE] use strict; use warnings; my $pattern="1234"; undef($/); my @array; my $count; while(<DATA>){ $count=(@array)=$_=~/$pattern.{1}/gi; } print "$count\n"; print "@array\n"; __DATA__ 12348097790797401234790 87989871234908098098909 87987983412344908098098 [/CODE] | |
Re: Strawberry Perl is more cross-platform than active state, from my understanding. | |
Re: Some quick questions: is this unix or windows? You have no directive for either on the first line (#!). Is the script executable by the web server? What error message are you getting (look in the web server error log)? What happens when you run the script at the command-line? … | |
Re: Personally, I'd use either Mason or the Template toolkit. It's much better than CGI. | |
Re: A couple of quick questions... 1. Is that one line of the file you are parsing? That is, will the => vm-jetmore] be at the end of a single line or does it span multiple lines? 2. Are those numbers always the same? Or do they change? As for whether … | |
Re: You need to provide more information in order for us (or me anyway) to create such a regex. What does your data look like? | |
Re: RTMF... [CODE] use strict; use warnings; my $x=0; while($x<100){ $x++; print "$x\n"; } print "the loop ran $x times\n"; [/CODE] | |
Re: Catalyst is an object-oriented, MVC (Model, Controller, View) architecture for Perl. The reason you use it is for writing big multi-tiered applications. Look into MVC and you can find out why there's an advantage to writing with such an architecture. It is componentized and it is built for testing of … | |
Re: Does the apache user have the right to execute the command? You should post the code. You probably want to redirect stdout to a variable too and then print the variable. | |
Re: my is a keyword for scope control. It also is required scope-wise for a perl program to pass strict and warnings. [CODE] use strict; use warnings; my $var="one"; print "$var\n"; { my $var="two"; print "$var\n"; } print "$var\n"; [/CODE] output: [CODE] one two one [/CODE] | |
Re: You're declaring the $red_select variable twice with "my". | |
Re: PeerAdder is a typo. It's supposed to be PeerAddr. | |
Re: What a mess! It appears that this script is a front-end to send mail (with attachments). If it were me, I'd scrap the entire thing and use a number of perl modules to accomplish the same task in 1/10th the number of lines. I'd also probably use a templating system … | |
Re: I'll do it for you, but I don't think you'll be able to turn it in as your work. [CODE] use strict; use warnings; use List::Util qw(sum max min); my @nums=<DATA>; my $sum=sum(@nums); my $avg=$sum/@nums; my $max=max(@nums); my $min=min(@nums); print "Sum: $sum\n"; print "Avg: $avg\n"; print "Min: $min\n"; print "Max: … | |
Re: It would probably be better/easier to use Net SMTP from CPAN to send the mail. See: [url]http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm[/url] | |
Re: Can you provide a few lines of the log file to show the options and what you wish to get out of it? | |
Re: A quick clarification... you said " If it does fall within the range, I want it deleted, if it does not then it stays." When I wrote this code, it didn't find records that matched this condition, did you mean " If it does [B]NOT[/B] fall within the range, I … | |
Re: [url]http://search.cpan.org/~shlomif/Statistics-Descriptive-3.0201/lib/Statistics/Descriptive.pm[/url] | |
Re: I still don't get it either. Where does $rec{user} get assigned? Where does it come from? Also, the print $_ is not going to work because you have assigned your foreach to $recd. If $rec{user} is not set you will get the message you are receiving BTW. | |
Re: Shouldn't the mkdir be "./proj/xy" or "proj/xy" if you wish to create within your home directory? "/proj/xy" would seem to try to create the directory from the root. | |
Hi all, There are not too many threads that I start, but I wanted to share with you all something I discovered last week that saved me tons of time. I have a program, which is way to long and complex to post here, that basically opens excel, reads data … | |
Re: [CODE] use strict; use warnings; my $other_list=('Hello,World,He,Can,See,Me'); my @other=split(/\,/,$other_list); my %ref; for (@other){ $ref{$_}=1; } while(<DATA>){ chomp; s/^\"//; s/\"$//; my (@comp)=split(/\"\,\"/); for (@comp){ $ref{$_}=0 if(!$ref{$_}); print "$_ is in other list\n" if($ref{$_}); } } __DATA__ "Hello","World","I","Can","See","You" [/CODE] Output: [CODE] Hello is in other list World is in other list Can … | |
| |
Re: Neither ssh or a standard c compiler ship with windows. You need a c compiler. You can get one from cygwin. | |
Re: What is it you have to "do" with each binary number. What is the content/function of the then{}? That makes a huge difference. I feel you have given us only 1/2 the problem. I mean, suppose a binary AND or OR or XOR would work? You haven't told us what … | |
Re: [CODE] use strict; use warnings; open(FILE,"<example1.txt"); open(OUT,">example2.txt"); my $x=0; while(<FILE>){ chomp; $x++; if($x==1){ print OUT "$_\n"; next; } my ($Compound,$H,$C,$N,$O,$P,$S,$Cl,$Co,$Se,$Class)=split(/\t/); if($C>10 && $P<5){ print OUT "$_\n"; } } close FILE; close OUT; [/CODE] | |
Re: I'm not sure that answering a question after 5 years is really effective. | |
Re: [CODE] my $post_string=<DATA>; [/CODE] | |
Re: Are you sure this is what you want to do? If so, you can control IE through perl... Remember though it is on the CLIENT, not the server. [CODE] use Win32::OLE qw( EVENTS in with valof ); use Win32::OLE::Variant; Win32::OLE->Option( Warn => 0 ); $HomePage = "http://www.google.com/"; $IE = Win32::OLE->GetActiveObject( … |
The End.