460 Posted Topics
Re: If you literally want to find "string" you can't put it in square brackets. That makes a character class and order of the characters is ignored. | |
Re: use the "g" option: [code] $string = 'abc 123 def 456 ghi 789'; @numbers = $string =~ /\d+/g; print "$_\n" for @numbers; [/code] Note I changed the quantifier * to + because * will match zero or more digits so it will match anything that is not a digit although … | |
Re: see your post on devshed | |
Re: line 6 above should be probably be written like this: [CODE] %{ $self->{items} {$key }} = @values;[/CODE] When you declare your new object initially you don't need the [] brackets in there: [CODE]my $self = { name => $name, items => {} };[/CODE] It may or may not be a … | |
Re: Chnage this line: [code]open(OUT, "+>", "$target") || die("Couldn't open file OUT $target");[/code] change to: [code]open(OUT, "+>", "$target") || die("Couldn't open file OUT $target: $!");[/code] and see what $! reports. I suspect file paths need to be adjusted for the computer the script does not run on correctly. | |
Re: found this on CPAN: [url]http://search.cpan.org/~mrdvt/Win32-OLE-CrystalRuntime-Application-0.08/lib/Win32/OLE/CrystalRuntime/Application.pm[/url] but thats is as much help as I can give you on this topic. | |
Re: You can't get the data sent to redirect.pl parsed by showdata.pl the way you are trying. You have to recieve the data in your redirect.pl script and save it to disk and have showdata.pl open the file and get the data from a file or send the data to showdata.pl … | |
Re: The problem is you are generating a random number based on the length of the array, not the values of the elements of the array. Here is what you want to do: [code] my @numbers = (48..57, 65..90, 97..112); my $num = $numbers[int rand @numbers]; print $num,"\n"; [/code] | |
Re: its like this: $pointer->() but I don't think thats his question. | |
Re: Sorry, I have no experience with installing either of those. | |
Re: It appears that you need to install DBD::mysql | |
Re: try using the full path to the file: open(INFH, '<', '[B]full/path/to/[/B]gettysburgh.txt') or die $!; | |
Re: Since this will be very dependent on the exact data in the file there is little sense in trying to help with data that is something similar to the real data. | |
Re: I have no esperience in what you are doing, but my first thought is are you sure you didn't make some type of a mistake? When you see a variable as literal text instead of the interpolated value of a variable its almost always a quoting problem. | |
Re: [CODE]if($form_element{'email'} =~ m/^[a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-]+([.][a-zA-Z0-9_\-]+)+[a-zA-Z]{2,4}$/i){ $values = 0; $mail = "Valid!"; } else { $mail = "InValid!"; } [/CODE] | |
Re: try: [B]while(/^\\insert{?(.*?)(\.tex)?}?/){ [/B] you don't need to escpae the {} brackets with \ | |
Re: [B]mishel [/B] Offline Newbie Poster What does the community think of mishel? Community Reputation Points: 10 Reputation-Altering Power: 0 How helpful is mishel at solving threads? Solved Threads Replied To: 0 [COLOR="Red"]Last Activity: Oct 6th, 2008[/COLOR] I'm eager to help too, but posting code for a person that has not … | |
Re: An interesting construct to do the same thing. No need to actually use a named array: [CODE]$_ = "fooFOObarBAR"; $count=()=/[a-z]/g; print "$count\n";[/CODE] But I would do it like this myself: [CODE]$_ = "fooFOObarBAR"; $count = tr/a-z/a-z/; print "$count\n";[/CODE] | |
Re: [QUOTE]so when the conditional of $item1=="7880" fires it will check "/[7880,5192,7879,0]/=="7880"[/QUOTE] Its possible (I think). Using a hash sounds like the better approach. Very simple example: [code] %item1 = ( 7880 => [7880,7879,5192,0], 7879 => [7879,7880,5192,0], 5192 => [5192,7880,7879,0], ); $item1 = $item1{$ARGV[0]} || die "Usage: no item found\n"; [/code] … | |
Re: Are you familiar with the CGI module? You can set and read cookies with the module. See the CGI documentation for details. [url]http://perldoc.perl.org/CGI.html#HTTP-COOKIES[/url] There is also the CGI::Cookie module | |
Re: try this, note the single-quotes: chdir('c:\mnt') or die "Can't chdir to c:\\mnt : $!"; see if die returns an error. Its actually better to use forward slashes even with windows, which fully supports their use in directory paths. chdir('c:/mnt') or die "Can't chdir to c:/mnt : $!"; That way you … | |
Re: [QUOTE=perl1user;775403]how do I retreive query string in perl ? let's say I have [url]http://server.com?name=foo[/url] how do I get the value of 'name' thx [email]cvv3@yahoo.com[/email][/QUOTE] Already answered on one or two other forums. | |
Re: Windows? Open a DOS window, and type: perl name.pl if perl is not in the command path: c:\perl\bin\perl.exe name.pl if the program is not in the same directory: perl c:\path\to\name.pl Thats the way I do it anyway. | |
Re: There is no short or easy answer to your questions. Perl uses the DBI (Database Interface) module to interact with a database. You also have to install the relevant drivers. For example if you wanted to communicate with a MySQL datasase you would install DBD::mysql. For interaction with Excel you … | |
Re: It could have something to do with a regexp, but since we can't see any regexps your code uses, there is no way to tell. | |
Re: RTM mate: [url]http://search.cpan.org/~hmbrand/Text-CSV_XS-0.58/CSV_XS.pm#Embedded_newlines[/url] | |
Re: just a guess, in this block of code: [code] #open (MLB2, ">> /data/local/GIS/WRKGIS.txt"); open (MLB2, ">> /awips/dev/localapps/kmltools/WRKGIS1.csv"); for ($i=1; $i<=$num1; ++$i){ if ($finline[$i] =~/[A-Z]+/ ){ write(MLB2); format MLB2= @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $finline[$i]; . } } [/code] change [b]$i<=$num1[/b] to [b]$i<$num1[/b] | |
Re: PPM is not for running your perl programs. Its for installing modules and other tasks related to modules. On Windows the way I prefer to run a perl program is open a DOS (or Command) Window and type: perl scriptname optional-arguments You may need to add the path to the … | |
Re: A students best cheat tool is a search engine or the search feature of a website or forum. You would have found a recent thread discussing the exact same assignment had you done just a little searching. [url]http://www.daniweb.com/forums/thread169597.html[/url] | |
Re: You can try the Benchmark or Time::HiRes modules, they come with perl. Read the documentation and try a few things, if you get stuck post back. | |
Re: You are comparing strings: if($ch eq"?" || $ch eq "!" || $ch eq ".") instead of searching for patterns: if($ch =~ /[?!.]/) EDIT: actually, let me try something, I think getc() might be affecting the code too. I never use it so I have to check how it works. | |
Re: You can't run commands inside of strings, well you can but its easier to just do it properly: [CODE]open(MYFILE, ">>/usage.file"); print MYFILE 'USERID: ', `whoami`, 'used this on DATE: ', `date`, "\n"; close MYFILE[/CODE] if whoami and date return with a newline then the above line will be broken up … | |
Re: FIrst thing I would recommend fixing the shebang line: [B]#!"C:\Program Files\xampp\perl\bin\perl.exe"[/B] The quotes should not be there: [B]#!C:/Program Files/xampp/perl/bin/perl.exe[/B] Note: You can use forward slashes on Windows The only other thing I see that looks suspicious is these lines: [CODE] my $result = SOAP::Lite -> service($google_wsdl) -> doGoogleSearch(@params);[/CODE] Try like … | |
![]() | Re: Did you have a question? What perl code have you tried to write to solve your programming rquirements? ![]() |
Re: your question is very hard to not only understand but also to read because you seem to not know how to make sentences that other people can read and make sense of so please edit your post and use proper grammar and post an example of the strings you are … | |
Re: Not only do you appear to never have heard of CPAN, maybe you never heard google or other search engine? The first result returned from google points to the CPAN archive as well as a wealth of other online resources related to the module: [url]http://www.google.com/search?&q=Parse::RecDescent[/url] Learn to use search engines … | |
Re: <SmartDrv<=<C:\\WINDOWS\\system32\\Setup\\SmartDrv.exe< | |
Re: Almost all modules have documentation. And almost all modules are listed on CPAN: [url]http://search.cpan.org/~timb/DBI-1.607/DBI.pm[/url] There are also many online resources that you can use a search engine to find and many perl books you can purchase or possibly borrow from a library if there is a library/school in your area. | |
Re: It looks like it should work but it will not alter the original file if thats what you are thinking. The only reason it will not work is if the regular expression is not finding the search pattern: \b$pattern\b When posting a question, saying "it does not work" is next … | |
Re: Next time I would prefer to see some effort to solve your programming reqirements before posting code. Here is one way it can be done: [code] my $dir = qx{dir}; open (my $OUT, ">", 'dir.txt') or die "$!"; print $OUT $dir; close $OUT; [/code] | |
Re: [QUOTE=Deathrains;763170]SO did u actually do something :? please share i also need it )[/QUOTE] Considering the thread is more than 3 years old your chances of a reply are slim. | |
Re: Well, I doubt there is a way to do it that is completely cross platform independent. Each perl version and even the same version for different operating systems and even the same version of perl for the same operating system but a different version of the operating all have quirks. … | |
Re: foreach is the wrong command to loop through a file but I am not sure if it is in anyway contributing to the problem. But try this: while (<INPUTFILE>) { See if it helps. | |
Re: for right now test your program input: [code] use strict; print "<$_>" for @ARGV; [/code] see what gets printed. Use the code tags to post your perl code. |
The End.