196 Posted Topics
Re: 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 * … | |
Re: 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, … | |
Re: 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? | |
Re: 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 … | |
Re: 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 … | |
Re: 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__ … ![]() | |
Re: 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 … | |
Re: 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. ![]() | |
Re: 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 … | |
Re: 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 … | |
Re: Hi, I believe there are alot of people that are willing to help if your question is clear enough. | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … ![]() | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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>) { … | |
Re: 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 … | |
Re: 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; … | |
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, … | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
![]() | Re: 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 … ![]() |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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: … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
![]() | Re: 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! |
Re: 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 => … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: #!/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; |
The End.