196 Posted Topics
Re: Hi Alexei, As you saw on this thread. This particular question was solved 3 years ago. You should start a new thread where others could see your question clearly and be able to help you out. | |
Re: If you are starting out, you can use **Learning Perl**, but if you already have a working understanding of Programming and a bit of Perl you can get Chromatic free e-book **Modern Perl** 2014 Edition. There is also a very recent Perl book by Ovid called **Beginning Perl**, very good … | |
Re: Normally, you will probably want to use a database for such a large file, in my opinion that would be more effective, especailly for a data as large as that. But of course there are several other factors that can work in our favour otherwise. That being said, I think … | |
Re: In the spirit of more than one way to do it, you can also do this: for i in '20140702_PAQT_B6h'.split('_'): if i.startswith('P'): print (i) elif i.startswith('B'): print (i) **Output** will be like: PAQT B6h Note however, that you can use this if you are actually reading from a file, you … | |
Re: I will agree with *JeffGrigg* here. At least show what you have been able to do. Where you are having problems. Am sure with the solution already posted you should be able to adapt to your own code. | |
Re: Hi, In solivng this type of problems, you have to open your two files, read from the second one and take the first two column as key/value for an hash. Then open the first file and read line by line and check if the last column is the same as … | |
Re: Hi anni, Using the code you posted, I can't reproduce your output. Since the dataset you posted had no tab in it, at least from the forum. However, using an algothrium similar to yours, I could produce what you wanted, I suppose given that your desired output is not displayed … | |
Re: hello Anna123, As much as I would like to help, I really don't see a correclation between the sample of the files you have posted. Or am I missing something? Please, could you described or give more or better data sample and tell what you are trying to **match**. That … | |
Re: hi, >Can anyone explain to me what I am doing wrong? (Or how to correctly return values from the subroutine?) What you are doing wrong is that: 1. You are not subclassing HTML::Parser, so if you run your code like you gave it what you are suppose to see is … | |
Re: hello Anna123, As much as I would like to help, I really don't see a correclation between the sample of the files you have posted. Or am I missing something? Please, could you described or give more or better data sample and tell what you are trying to match. That … | |
Re: Hi, How would you write this yourself. i will show one of the ways by which this could be written. How to display the result is left for the OP as an execricse. use warnings; use strict; use Data::Dumper; my %data; my $key; while (<DATA>) { if (/User.+?(\S+):/) { $key … | |
Re: Yes. There is GUI in perl. But there are certain things you should know before getting into GUI in perl like Scalar type, array and hash. References and Object-oriented programming. You however need have module like perl/Tk installed on your system. Check [Tk](http://search.cpan.org/~ni-s/Tk-804.027/pod/UserGuide.pod) | |
Re: Hi [mcsreerag], > What shall I do? The question is What have you done? Show us some honest effort on your part and the areas you having problems with, then am sure someone will surely come up with a sound solution. Meanwhile, if you are on *nix* system you can … | |
Re: Hi hasvi, > I need how to call xml file, in the above script. Please help me. How do you mean call xml file? Please don't try to parse xml file using regex, you can use modules on metaCPAN or CPAN such as [XML::Simple](https://metacpan.org/pod/XML::Simple) for what you are trying to … | |
Re: Hi, Maybe the OP wanted something like so: use warnings; use strict; my $sep = qr/-/; my $xml = qq[<opt_cisco>\n]; while (<DATA>) { next if /^$/; chomp; my ( $tag, $content ) = split /$sep/, $_, 2; $xml .= qq[<$tag>$content</$tag>\n]; } print $xml, qq[</opt_cisco>\n]; __DATA__ client1-10.1.1.1/24 clientgw1-10.1.1.2 server1-10.1.1.3/24 servergw1-10.1.1.4 client2-10.1.2.1/24 … | |
Re: Hi xyciana, This answer might be coming a bit late, but am sure it will be useful. Using the data you posted, you can simply use `XML::Simple` as you are doing with `Text::CSV` or you use a better xml parser like `XML::LibXML`. Yes, `XML::Simple` can simply take on your dataset … | |
Re: Hi magikman, Going through your post, I think you are either asking two different questions or the first question is a sub-set of the second one. The first question on it own as stated: >I am trying to write a Perl script that searches through a directory on Windows and … | |
Re: Hi newperluser, > I am new to Perl You are welcome to using Perl, a great programming language and tool. It would have been wonderful, if you have shown what you have been able to do yourself, then you can get help and correction. However, I observed that your data … | |
Re: And how would you do it? You will need proto make an effort here, then you will get help from others. Helping you with your project or assignment does not include doing them for you. Is that not? | |
Re: Hi vineeth.shankar1, >My problem is, how to compare user name with the name of the file How are you doing it? Please check the documentation and usage of `strcmp` like so `man strcmp` on *nix* systems. | |
Re: hi [mohit c] > I am unable to understand why 10 in the last line is printed. Please help... Your input file has a blanck line (new line) after the the line `12sdfsldkfj` i.e if the line of your input is `1`, the blanck line is `2` remove it and … | |
Re: > Is this correct? No, Not in the way you are doing it. There are several stuff missing in your code. Like in your format used in the `scanf`. Moreso, you might want to use `fgets` instead. @Ancient Dragon: > You can't nest one function inside another. I think it … | |
Re: Hi, > here is the original codes that has been set in the question paper Is it permitted in your school to share and ask for help on a question paper, that is not an assignment? | |
Re: Hi [nitish.mohiputlall], When I compiled and run the first code you gave. All the element in the array were all initialized to `0`. All that were displayed on the CLI. But while using the second set of codes because of `(ptr=ptr+2)` all the odd element of the array weren't initialized … | |
Re: >I want this printf("\n%d \n",test(&a[i])); to work. What do you think line 13 is doing? Or what do you hope to achieve with it? Then check what you passing to the test function. | |
Re: Hi yann.bohbot.9, >*I'm just trying to scan an array using a pointer but when i print it it shows me only zeros. Any help?* first, your main function has a return type of `int` yet doesn't return any, as though you have declare it with return type `void`. Secondly, though, … | |
Re: Hi realoneomer, It's good to always give a trial on something, even when someone is new to such and then ask for help, expect you are really to pay for the services you are asking for. But let me assume you are totally new on perl. I would give you … | |
Re: In addition to what as been said here. Maybe you could start with following documentation right from on top of your system, it will cost you nothing but time. Just type the following on the CLI `perldoc perlrequick`, for a quick start. Then a bit longer one `perldoc perlretut`. You … | |
Re: You might what to use `defined` in perl. Please check [defined](http://perldoc.perl.org/functions/defined.html) | |
Re: Hi, Use `cpanm` to install the module and it's dependencies. See [cpanm](https://metacpan.org/pod/release/MIYAGAWA/App-cpanminus-1.7001/bin/cpanm) | |
Re: Hi, I think you will do yourself a lot of good if you really understand data types in C. So that you don't confused `char` data type with `integer` data type. Then also note that in C, *string* is just `char` array. So understanding array is key. **gerard4143** raised a … | |
Re: And your question is? Then when you complied your code what did you get? ![]() | |
Re: Hi, Is either you are working with *MaddTechwf* or you are the same person with a different username. Like I mentioned on his trends which is marked solved, there are better way of doing what he wants. Moreover, except I don't understand his requirement, how are you getting your straight … | |
Re: Try using [WWW::Mechanize](https://metacpan.org/pod/WWW::Mechanize). It a lot better. | |
Re: Hi MaddTechwf, Please don't comment out `use strict;` from your script. It helps a great deal. Fine, you have what you wanted. But am sure there are several ways of doing what you wanted, even better, I suppose. There are several codes here one can improve on. But since you … | |
Re: Hi, Please can you check the usage of `sprintf` using `man sprintf` if you are using a *nix OS*. I don't think, you are using it rightly. | |
Re: Hi hema_24, One way of solving this kind of problem is like this: Make an hash and get the data from your condition_files, and then read from the other files onces at a time. Since, the first two columns seerated by commas are what is needed for comparism. One can … | |
Re: Hello perlbegginer02, This sound to me like an assignment. However, if you ask for help atleast you are suppose to show some effort on your part. The Gettysburg Address you didn't post and there was no script whatsoever. I will give show how to solve this but you will have … | |
Re: Hi Bhavya scripted, Welcome to daniweb and to the world of all possibility, I mean Perl Programming Language. You might probably want to check this [Perl Binaries for Windows](http://www.perl.org/get.html#win32) | |
Re: Hi preeti2, You can do the following: Since split function uses regex, you can split on or OR and OR ( OR ) and space, then print out your result as you desire like thus: use warnings; use strict; my $reg = qr/ or | and |\s+\(|\)\s+|\s+/; while (<DATA>) { … | |
Re: Hi genetist, There are several things in the your explination of the what you want that is not clear. However, following the title of your post and with a little understanding of what you wanted I came up with the following that I believe will help you a great deal. … | |
Re: Hi Perly, In your code, variable **$col12** is not defined. Check it. Moreover, you don't have to do it this way. You can try this: use strict; use warnings; while (<DATA>) { for my $value ( ( split /\s+/, $_ )[ 2 .. 13 ] ) { print $_ and … | |
Re: It would have been wonderful if you give an example of what you are trying to achieve. However, you could check if this link can help.[Using regexp with binary data](http://www.perlmonks.org/?node_id=487261) | |
Re: Hello leghorn, Good morning, If I may comment on your Perl script. $resFile = &getFileName($ARGV[0]); $fileType = &getFileType($ARGV[0]); You don't need the '&' in front of your subroutrine in this case. Though '&' is optional for perl subroutine or function as other programming language calls it. What does those mean? … | |
Re: Hi, It easily done, but you are going about it the wrong way. In the first place you don't need Spreadsheet::ParseExcel since you are not parsing excel sheets. Then again why read into an array, only to empty it again. Lastly, you are going over each file and make a … | |
Re: Hi, How do you mean? > detect when a field is focused in an external program? Please explain more what you intend doing. | |
Re: Hi salem_1, Actually, if you check in the this forum am sure what you intended have been done again and again. You can check this for example [file comparism in Perl](http://www.daniweb.com/software-development/perl/threads/445920/file-comparision-in-perl) You can modify these solution to suit your requirement. Hoe this helps | |
Re: Hi anglaissam, Foremost, please use 'warnings' and 'strict' in your script, it will have in a million ways; talking from experience. Secondly, don't program in a cage!!! What do I mean? use what has been provided in the program. Instead of doing the job all by yourself. For example in … |
The End.