460 Posted Topics

Member Avatar for KimJack

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.

Member Avatar for KimJack
0
76
Member Avatar for orwell84

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 …

Member Avatar for KevinADC
0
94
Member Avatar for ITSAMB
Member Avatar for ItecKid

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 …

Member Avatar for KevinADC
0
89
Member Avatar for mjump54

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.

Member Avatar for KevinADC
0
254
Member Avatar for mainak001

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.

Member Avatar for KevinADC
0
229
Member Avatar for Silver Snail

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 …

Member Avatar for Silver Snail
0
896
Member Avatar for sid78669

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]

Member Avatar for KevinADC
0
97
Member Avatar for dattaforit
Member Avatar for raghavendra83
Member Avatar for Sappster
Member Avatar for KevinADC
0
79
Member Avatar for klactose
Member Avatar for spivey
Member Avatar for mtramnes
Member Avatar for mtramnes

try using the full path to the file: open(INFH, '<', '[B]full/path/to/[/B]gettysburgh.txt') or die $!;

Member Avatar for KevinADC
0
172
Member Avatar for rolinski
Member Avatar for pharitha

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.

Member Avatar for mitchems
0
152
Member Avatar for mitchems

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.

Member Avatar for mitchems
0
141
Member Avatar for sid78669

[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]

Member Avatar for sid78669
0
331
Member Avatar for viktorijakup

try: [B]while(/^\\insert{?(.*?)(\.tex)?}?/){ [/B] you don't need to escpae the {} brackets with \

Member Avatar for KevinADC
0
112
Member Avatar for pong pong
Member Avatar for mishel

[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 …

Member Avatar for KevinADC
0
188
Member Avatar for perl1user

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]

Member Avatar for KevinADC
0
310
Member Avatar for k88joshi
Member Avatar for headedtomexico

[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] …

Member Avatar for Comatose
0
156
Member Avatar for localp

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

Member Avatar for mitchems
0
148
Member Avatar for aparna balkwade

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 …

Member Avatar for mitchems
0
1K
Member Avatar for perl1user

[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.

Member Avatar for mitchems
0
139
Member Avatar for jimwall80

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.

Member Avatar for mitchems
0
162
Member Avatar for sk8te320

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 …

Member Avatar for mitchems
0
116
Member Avatar for headedtomexico

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.

Member Avatar for KevinADC
0
101
Member Avatar for john_prince

RTM mate: [url]http://search.cpan.org/~hmbrand/Text-CSV_XS-0.58/CSV_XS.pm#Embedded_newlines[/url]

Member Avatar for john_prince
0
184
Member Avatar for drsmith

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]

Member Avatar for KevinADC
0
133
Member Avatar for mtramnes

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 …

Member Avatar for KevinADC
0
131
Member Avatar for mtramnes

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]

Member Avatar for KevinADC
0
125
Member Avatar for orwell84

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.

Member Avatar for orwell84
0
158
Member Avatar for inked

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.

Member Avatar for inked
0
194
Member Avatar for jehamilt

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 …

Member Avatar for KevinADC
0
134
Member Avatar for spanish

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 …

Member Avatar for KevinADC
0
160
Member Avatar for green_lakers

Did you have a question? What perl code have you tried to write to solve your programming rquirements?

Member Avatar for green_lakers
0
103
Member Avatar for inked

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 …

Member Avatar for KevinADC
0
122
Member Avatar for perl1user

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 …

Member Avatar for KevinADC
0
213
Member Avatar for protonix
Member Avatar for KevinADC
0
75
Member Avatar for Paryushan

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.

Member Avatar for KevinADC
0
148
Member Avatar for Paryushan

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 …

Member Avatar for Paryushan
0
80
Member Avatar for Paryushan

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]

Member Avatar for KevinADC
0
119
Member Avatar for nathanpacker

[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.

Member Avatar for verruckt24
0
189
Member Avatar for PC_Nerd

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. …

Member Avatar for PC_Nerd
0
1K
Member Avatar for peg110

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.

Member Avatar for KevinADC
0
207
Member Avatar for 000stephen

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.

Member Avatar for 000stephen
0
140

The End.