196 Posted Topics

Member Avatar for ali11

Take note to what nitin1 said, however, there are other issues. 1. In your Getprice() function you didn't variable output was not declared. It just came out of the blues. These I did to make it work: #define MARKUP 0.1 float GetPrice(float finalvalue) { finalvalue = finalvalue - MARKUP * …

Member Avatar for VatooVatoo
0
189
Member Avatar for PikapikaPi

Hi, You might be new to C++, but probabily not new to programming in general. If so, write solve the problem using the programming lang. you know, then try it out using the C++ syntax you have learnt so far. Here is a psuedo code: define and initialise a counter, …

Member Avatar for 2teez
0
183
Member Avatar for aecha

Please, you can check this link: http://perldoc.perl.org/perlfaq4.html#How-do-I-compute-the-difference-of-two-arrays?-How-do-I-compute-the-intersection-of-two-arrays?

Member Avatar for 2teez
0
57
Member Avatar for sateal8

Hi sateal8, Below my comments is the modified script of yours that works, just as you wanted it. Before then please check the comments. >Thank you for the response but we havent covered hashes yet. You may read it up. >... i cant figure out how to match the number …

Member Avatar for 2teez
0
124
Member Avatar for perly

This work perfectly, but you can modify it for your use. #!/usr/bin/perl use warnings; use strict; use Tie::File; my $time = scalar localtime(); my $heading = qq(Date of search: $time\nThe following were found:\n); my %header; my $input1 = 'input1.txt'; my $head = ""; #open input file1 for reading open my …

Member Avatar for 2teez
0
266
Member Avatar for subok

Hi, You can easily get that done like so: #!/usr/bin/perl use warnings; use strict; push my @value, map { ( split /;/, $_ )[ 12, 13 ] } grep { /STPSTR01.134/ } <DATA>; $value[1] <= 0 ? print " can't divide by 0" : printf "%.6f", $value[0] / $value[1]; __DATA__ …

Member Avatar for Kwetal
0
205
Member Avatar for caven.chunyen

Hi, If I may ask, it is the file with extension you want? i.e Iterate through all the file in a particular directory, search all the folders and copy or move all the file with a particular extension to another folder. Is that what you want? Wanting to be sure …

Member Avatar for extension wpd
0
317
Member Avatar for daino

Hi, Please, check the following: check pp http://search.cpan.org/~rschupp/PAR-Packer-1.013/lib/pp.pm and PAR http://search.cpan.org/~rschupp/PAR-1.005/lib/PAR.pm from CPAN. I think that is what you are looking for. You may also google citrusperl and cavapackager.

Member Avatar for Kwetal
0
263
Member Avatar for jassipox

Hi Jassipox, There are several ways of solving this problem. I would have really love it, if you have shown what you have tried so far on your own. However, I will show a solution here, that really solved the problem you posted. And I can only wish you take …

Member Avatar for d5e5
0
258
Member Avatar for caven.chunyen_1

Hi, > it possible to create an Excel Movie Library with the movie poster, the name of that file and a hyperlink of that clip is attached to the poster. Very Possible. You could check this cpan modules: For Excel which also include 2007 up, use this http://search.cpan.org/~jmcnamara/Excel-Writer-XLSX-0.49/lib/Excel/Writer/XLSX.pm For Older …

Member Avatar for 2teez
0
117
Member Avatar for faezshingeri
Member Avatar for 2teez
0
216
Member Avatar for sayerada

Hi sayerada, >I believe this would be best done with a hash table I think you are on track. See Related Article: **Search a file with multi-element contents of another file**, as a pointer. Also, show what you have been able to do and where you are having problems. And …

Member Avatar for 2teez
0
233
Member Avatar for Cupidvogel

Hi, check **pp** http://search.cpan.org/~rschupp/PAR-Packer-1.013/lib/pp.pm and **PAR** http://search.cpan.org/~rschupp/PAR-1.005/lib/PAR.pm from CPAN. I think that is what you are looking for. You may also google citrusperl and cavapackager.

Member Avatar for 2teez
0
171
Member Avatar for shensteffi

Hi shensteffi, Please, note that you can't just dump codes on people to resolve for you. Or expect people to know what you are thinking because you put several lines together to do some stuff for you. If you are asking for help, then you should ask nicely. Explain, whant …

Member Avatar for 2teez
0
165
Member Avatar for PhoenixInsilico

Hi PhoenixInsilico, Using perl inbuilt function **system(...)**, you could do want you want. But really i don't know how you are **feeding in your data** into the executable file. Below is an example. A simple C file to get a number from CLI. The file is complied as **file.exe**, and …

Member Avatar for chandrashekar
0
220
Member Avatar for perllearner007

Hi perllearner007, Cool that you are doing great with Perl. However, I think it should be mentioned that when altering the input line record separator namely $/ in Perl since it influences ( or define ) what a line is. You will want to use it in a loop of …

Member Avatar for Kwetal
0
348
Member Avatar for perllearner007

Please, give more info: 1. Why use LWP::Simple when there is really nothing the module is doing, since you are getting your names and ids from a text file called 'intput.txt', 2. You can also use the module CGI to generate your html files. 3. Also show how your input …

Member Avatar for d5e5
0
128
Member Avatar for perly

Hi perly, Yeap, just like want you have done, but with a little modification. The code below should solve your problem nicely. I hope this help. #!/usr/bin/perl use warnings; use strict; use Carp qw(croak); croak "usage: <perl_script> <file1> <file2>" unless @ARGV; my $time = scalar localtime(); # get date of …

Member Avatar for perly
0
293
Member Avatar for vallarakesh

Hi vallarakesh, >on executing above code the output is 32723 but the out should be 906609.. Check the modify code below: #include<stdio.h> #include<conio.h> #include<math.h> int pal(long int); /* declare your function */ int main() { /* use int main() not void main() */ int i, j, con = 0; long …

Member Avatar for 2teez
0
200
Member Avatar for tunisia

Hi Trentacle, I suppose you really want to write: $x = $x + $y; instead of > $x = $x + y Hi tunisia, In addition to what Trentacle wrote you could read **Assignment Operators ** under perldoc perlop documentation from your Command Line Interface.

Member Avatar for Trentacle
0
122
Member Avatar for rupes0610

Hi rupes0610, Check the following: Check your line 10, you probably omited something like: @data = <FH>; You didn't close the open file handler, neither did you test for failure. I also think line 19, should be something like: print $line; not print @L1; Moreover, I believe you can do …

Member Avatar for 2teez
0
122
Member Avatar for PhoenixInsilico

Hi Phoenixlnsilico, Your posted code could also be written like so, my $input_file='specialchar.txt'; open my $fh2, '>:encoding(UTF-8)', 'print.txt' or die "can't open file: $!"; # file to write to open my $fh, '<:encoding(UTF-8)', $input_file or die "can't open $input_file: $!"; # file to read from binmode $fh,":encoding(UTF-8)"; while (<$fh>) { …

Member Avatar for 2teez
0
99
Member Avatar for Serpterion

Hi Serpterion, I believe what you wanted, could be easily done in Perl. That been said, before any code is written I noticed that the number of IDs do not tally with the numbers of Names with Location, Please, clearify this, since, you want "Name" "Location" "IDs" as columns in …

Member Avatar for Serpterion
0
189
Member Avatar for perllearner007

hi Perllearner007, I would have really love to see what you have tried out atleast. But not-with-standing the code below could do what you want. Ofcourse, there are other ways of achieving this same thing. Any of the code below will do the job nicely! #!/usr/bin/perl use warnings; use strict; …

Member Avatar for 2teez
0
224
Member Avatar for 2teez

One of the finest initiative was the full documentation bundled with every version of Perl Programming language. Using the plain old documentation (*pod*) utility called *perldoc* one can literally read or learn the programming language without another book. E.g perldoc perl gives you the Name of the perl language Interpreter, …

0
145
Member Avatar for PF2G

Maybe want you are looking for is $row_users == 1 Note that **==** means "equals to", **!=** means "not equals to", while **=** means "get" in visually all the programming language.

Member Avatar for pritaeas
0
160
Member Avatar for perly

Nice one d5e5, I was going to point out your initial statement of just switching the last solution posted, the other time. It works fine! However, I decided to add and remove a little to see how another solution looks. Ofcourse, are we not talking Perl? Believe me it fun …

Member Avatar for perly
0
224
Member Avatar for perly

Hi perly, There are several gray areas in the code you posted, time will not permit me to point out here. However, the code below does what you wanted. Please take it as a guide. It was written on window OS, so don't mind #!/usr/bin/perl. Hope it helps #!/usr/bin/perl use …

Member Avatar for perly
0
206
Member Avatar for tonyprotop

Hi tonyprotop, The script below can do what you want, but there are some questions like: Is your output file also a text file or a html file, so that all the urls contents are saved and viewd as html file also. OR are you trying to parse the contents …

Member Avatar for tonyprotop
0
179
Member Avatar for HTMLperson5

Hi HTMLperson5, > Could you put anotherifnext to the place where it says: > > You said: blah > > like this: > > You said: blah, are you sure?(y/n) > > and then the user must type y or n for the program to continue. why not? See the …

Member Avatar for HTMLperson5
0
157
Member Avatar for achava

Hi achava, Instead of matching your input indivdually, you could use this: .+? # see explaination below '.' The dot matches any single character, or even newline when **s** modifier is used. '+' The plus or cross [ whichever you chose to call it ] then matches "one or more …

Member Avatar for 2teez
0
303
Member Avatar for abulut

Hi abulut, Foremost, when asking for people's help please and please be polite. Your statement > I want you guys to prepare a script. I will attach output.txt file could put people who are willing to help off. Secondly, Microsoft Excel or Openoffice Calc can easily get this kind of …

Member Avatar for abulut
0
133
Member Avatar for erezz

Hi erezz, The program below will give you the output you want. Please note that this program will be in the same directory with your text files or you might have to specify the path to these files yourself from the program. The result is saved to a file called …

Member Avatar for erezz
0
213
Member Avatar for hypernova

In C, you must know what you are doing. You have already decleared variable a, b and c as a single **char** and you wonder why, your printf only print a single character from the keyboard using scanf()?. If you want more than a single character then you can do: …

Member Avatar for hypernova
0
302
Member Avatar for perllearner007

perllearner007: To add to what d5e5 already said you don't need exit in Perl to exit your script. Also in your die statement always check for error incase the open function fails by using *$!* Please also consider writing clear Perl 5 syntax of codes. d5e5: Nice one using split …

Member Avatar for perllearner007
0
231
Member Avatar for erezz

This does all that you want, I believe (Please take it also as a guide in the right direction). Also note that the final output is to a new file called **new_file.txt** or any other name you might give it. #!/usr/bin/perl use warnings; use strict; my @files = qw(PT1.txt PT2.txt …

Member Avatar for erezz
0
240
Member Avatar for perllearner007

Really, you could use any RDBMS to solve this. However, it was real fun doing it with Perl. The codes below does what you want though, but **note** it will only use the name to find other family members and print **as you wanted it **, not the order way …

Member Avatar for perllearner007
0
161
Member Avatar for Josue198s

Run your cgi, as perl script on a CLI and see if it works first, if fine, then the script **should** not be the problem, you may also check your error.log in the log folder inside Apache, that should point you in the right direction!

Member Avatar for 2teez
0
137
Member Avatar for himanshuyadav

Check the script below, it does what you want: #!/usr/bin/perl use warnings; use strict; my $rec = []; open my $fh, '<', 'input_file1.txt' or die "can't open file:$!"; while (<$fh>) { chomp; next if /^\#/; my ( $key, $value ) = split /\s+/, $_, 2; push @$rec, { $key => …

Member Avatar for 2teez
0
210
Member Avatar for Perlie

Hi Perlie, There are so many things wrong with your code. But I guess that is because this was just a rough script to get the job done. Please, check the the code below, it does want you want. **Note** The result of this code is saved in a file …

Member Avatar for d5e5
0
216
Member Avatar for moshe12007

Hello moshe12007, To make your script work why not just use **use strict** and declare all your variable with **my**, as i have done below in **case 1**, and I believe your code should work. However, except for just checking out how recursion works on file directory using Perl, I …

Member Avatar for moshe12007
0
127
Member Avatar for abhik1368

I felt like it's fun and that I can improve on the previous solution. #!/usr/bin/perl use warnings; use strict; while (<DATA>) { print join " ", map { $_ > 1.0 ? '1.0' : $_ } split / /, $_; } __DATA__ 0.5 0.8 0.9 0.10 1.0 0.5 0.75 0.6 …

Member Avatar for 2teez
0
112
Member Avatar for Nole_diver

Nole_diver, why use a 'goto' when you can use a block and a 'redo' or a 'do' loop as shown below: case 1: START: #START GOTO command { # start of block **CODE REMOVED TO SAVE SPACE** print "Continue? (lower case only) \n"; chomp( my $choice = <STDIN> ); if …

Member Avatar for 2teez
0
120
Member Avatar for algo_man

The script below could what you wanted. > {{ text > text > text {{ text > text}} > text }} > Should be undeleted > Should be undeleted > Should be undeleted > Should be undeleted > {{ text > text > text {{ text > text}} > text …

Member Avatar for 2teez
0
170
Member Avatar for MCLASS80

The code below will do what you wanted, please feel free to ask any question. NOTE: DO NOT use **send** as your subroutine name, as perl has a function called send. Do **perldoc -f send** to check it. #!/usr/bin/perl use strict; use warnings; open my $fh, '<', 'csv.txt' or die …

Member Avatar for 2teez
0
336
Member Avatar for Niner710

#!/usr/bin/perl use warnings; use strict; my $data = ' |,0.005,0.004,0.004,0.005,0.006,0.005,0.006,0.005|,0.005,0.006,0.004,0.005,0.005,0.004,0.004,0.006|,0.004,0.004,0.004,0.004,0.004,0.005,0.004,0.004|,0.005,0.003,0.004,0.004,0.005,0.005,0.004,0.003|,0.005,0.003,0.004,0.004,0.005,0.004,0.005,0.004|,0.004,0.004,0.004,0.004,0.004,0.003,0.005,0.004|,0.005,0.004,0.005,0.005,0.005,0.005,0.005,0.004|,0.005,0.005,0.005,0.005,0.005,0.005,0.004,0.004'; my @data = grep $_,split /\s+?|\||,/, $data; print $_, $/ for @data;

Member Avatar for 2teez
0
173

The End.