RE: Where to change @INC in perl
Is there anyway for setting the libraries manually. See perldoc perlrun for how to include a directory in @INC, which is where perl looks for libraries: -I*directory* Directories specified by -I are prepended to the search path for modules (@INC), and also tells the C preprocessor where to search for include files. The C preprocessor is invoked with -P; by default it searches /usr/include and /usr/lib/perl. hth -- Lee Goddard Independent Contractor, Software Development/Analysis BBC Radio Music Interactive * Room 718 | Henry Wood Hs | Regents St | London W1 1AA | UK * 020 776 50849 * lee(at)server-sidesystems.ltd.uk http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Maximum value in Hash
sort values %hash? -- Lee Goddard Independent Contractor, Software Development/Analysis BBC Radio Music Interactive * Room 718 | Henry Wood Hs | Regents St | London W1 1AA | UK * 020 776 50849 * lee(at)server-sidesystems.ltd.uk -Original Message- From: Andrej Kastrin [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 8:53 AM To: beginners perl Subject: Maximum value in Hash Dear all, I'm looking for simple (and fast) solution to extract maximum value from a hash. I search over the Perl mailing lists, but I didn't find anything usable. Thanks in advance for any suggestion, Andrej -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this.
RE: Regexp Basics
#!/usr/local/bin/perl use strict; my $string = Theres more than 1 way to do it; if ($string =~ /\w+$/){ print Hooray! pattern found; print $1; } You need to wrap the bit you wish to extract in (paremphasis) and it'll be put into $1. If you do two (wraps), you'll get $1 and $2, and so on. Or you can assign the extraction-match direclty: my ($one, $two) = $search_this =~ /(put_into_one)(put_into_two)$/. -- My goal is to print the last word. However, it only prints Hooray! pattern found; Any idea what's wrong with $1?? Thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Date and Time Functions
Xavier Mas i Ramón [mailto:[EMAIL PROTECTED] : A Dijous 21 Setembre 2006 01:38, [EMAIL PROTECTED] va escriure: I am looking for some simple perl functions that will return the current date and time in string format. The purpose is to create a file with part of the name being the date and time. sytem date spits out an string of 30 characters long to standart output with current date and time followed by a newline. System date? Not on my system is doesn't: that's terrible perl advice to give since it doesn't relate to a perl function, which is what the chap was asking for. I'm sure you've heard by now, but in case you haven't: perldoc -f localtime for today's date and time, in parts you can arrange as you wish. For yesterday or tomorrow you might want to look at DateTime and http://datetime.perl.org/ Hth -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: URL need not do enciding
I have a String which I am forming inside a variable. Say my $urlString=http://www.yahoo.com/mail?username=anishkumar_kus erid=1234.0companyname=abc. I am printing this string in a browser through CGI. In that case I am getting the URL with encoded characters for = say now it looks like http://www.yahoo.com/mail?username=anishkumar_kuserid%3234.0; companyname=abc Please check the userid value it is encoded. How can I stop change the URL. You could try using UTF-8 URIs, but otherwise you have to encode all names and values in the URI, or it's not a URI. -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Non-technical question
From: Ricardo SIGNES [mailto:[EMAIL PROTECTED] Sent: 21 September 2006 01:19 To: beginners@perl.org Subject: Re: Non-technical question X-Message-Flag: Warning: This sender thinks he is better than you. X-Planet: Planet of the Apes User-Agent: Mutt/1.5.11+cvs20060126 Nice headers, Ricardo. Anyway, fwiw: * Mathew [EMAIL PROTECTED] [2006-09-20T19:29:53] I'm curious how to pronounce various built-in variables in perl. We don't do buck in the UK: it's usually dollar or scalar. But there's no fixed way of doing it anywhere in Europe, that's for sure. Peronsally I like: $_ it, that, the thing @_ the stack Anything beginning % I call hash; anything else beginning @ I call 'array' $foo is just plain 'foo' for me. For $foo[1] I say 'first element of foo' or $foo[$i] 'the I index' and so on. It gets interesting with deeper structures: $sself-{xml}-{feet}-[1] -- the first element in the array held in self's xml's feet field. Interesting but ugly. I tend to read Perl as if I were translating it to plailn English, and treat the source as if it were notes. If anyone ever asks for details, then I break it down into symbols and types. Hth -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: array help
if i use one array in foreach loop then can i use same array in another part of the code. What do you think? Have you actually tried to do this? Perhaps you could submit the smallest possible piece of code illustrate your prediciment? -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: transition to Perl developer
From: JupiterHost.Net [mailto:[EMAIL PROTECTED] Derek B. Smith wrote: OK CPAN yes I know it is an open source project, but are there task assignments for specific tasks/projects as opposed to submitting a module? So you are looking for an open source project done in Perl that has a community todo list that you can contribute to or an open source Perl app that manages a task by having a list of todo's that developers can take on? I'm not sure what Derek is looking for, either, but have a look at: * bestpractical.com/rt/ An open-source request/bug/job tracker, which is also used as part of the CPAN projcet: rt.cpan.org * www.cpanforum.com Open-source Perl project, linked from every page of CPAN, which has a good TODO list. Lee -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Newbie Question
use strict; use warnings; my $string; while (1){ print Please enter 1-5 letters: ; chomp ($string = STDIN); last if $string =~ m/^[a-z]{1,5}$/i; # last if $string =~ m/^\w{1,5}$/; print that is wrongtry again: ; } I think the problem was not the pattern so much as the rest of the logic. The pattern you have will match a lower- or upper-case letter of the alphabet one or five times. I can't see how anchoring it to the start or end of the $string would help anything other than perhaps internal efficiency, for which I'd anchor it at both ends (^ and $ for start and end). I would suggest using the /i modifier, so instead of /[a-zA-Z]/ to match any letter, you could /[a-z]/i. But that's not really 'any letter' -- it's just a to z, which may ignore accented and other UTF-8 characters. You can find better options in perldoc perlre -- see esp. the POSIX section. Your original code also seemed to be warning of an error before taking input, but I guess that's a cut-n-paste issue. Hth lee From: M K Scott [mailto:[EMAIL PROTECTED] I have tried that to no avail. I have also tried a simple match of !~ m/(m|f){1}/ and even put in the code you suggested to read !~ m/^(m|f){1}$/ but this still doesn't work properly. Input of d or T will work to say it is incorrect and input of m or f will be accepted but I was under the impression that the {1} would limit it to only accept a single character while in practice it still accepts ff and mmm. Any ideas? One further question though, an example question I am doing asks for a text file to be read in and the number of digits to be counted (ie 3 1's, 6 2's etc) and I can read input in and do a 'getc' and pattern match that against a hash containing word references to the numbers and then add one to a count but is this the best way to do this? Thanks again, Mark From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Wed 20/09/2006 01:12 To: Perl Beginners Subject: Re: Newbie Question M K Scott wrote: Hi all, Hello, Please forgive the newbie nature of this question but i'm just starting off teaching myself perl from scratch and so need a little clarification. I am trying to put together a script to do pattern matching and while I can get the basic syntax alright it doesn't seem to be working as expected. For one example I need to match a user input and make sure it is a certain length (i.e. doesn't exceed a certain number of characters) and this is the code so far: while ($string != m/[a-zA-Z]{1,5}/ ) { print(that is wrongtry again: ); chomp ($string = STDIN); } You need to anchor the pattern like /^[a-zA-Z]{1,5}$/ -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Modules aiming at displaying mathematical functions on screen?
After searching the cpan.org site for mathematical modules, I did not find a module which can display graphically the result of a function. I want to see a function curve displayed in a graphical window? How can I make it possible in Perl? Thanks in advance for your help. Module names in quotes: You could build a perl Tk application - it comes with an example related to your query. You could use GD or Imager or Image::Magick to plot pixels and save as various graphics formats. (The latter also exports LaTex, I believe). You could look up the mailing list for PDL, the Perl Data Language subset, where people who *really* know about maths hang around. You could make a PDF using PDF::API2 but that's probably a little trickier than most things above. You could look under Graph on CPAN Hth Lee -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: :Graph...crashing...
I'm trying to use the GD module. for plotting a graph on WINDOWS but my Perl script is crashing. Here is the piece of code which is crashing [Perl Command Line Interpreter has encountered a problem and needs to close. We are sorry for the inconvenience.] use GD::Graph::bars; my $graph = GD::Graph::bars-new(400, 300); It's not your syntax, it's fine here on 5.6.1 and 5.8.8. Try re-installing GD-Graph using the Perl Package Manger (you may need to remove the package first). hth -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: :Graph...crashing...
From: Nagasamudram, Prasanna Kumar Hi Lee I tried to search for the GD module through ppm and was unable to find it, so I downloaded the tar file from cpan and installed it manually. Ah, that's the problem: GD is a perl binding (Perl, C and glue) to GD. Do you have a compiler? But - I just did PPM search and got : ppm search GD 1. CGI-Application-Plugin-LogDispatch [1.00] CGI-Application-Plugin-LogDispatch 2. CGI-Builder-LogDispatch [0.1] CGI-Builder-LogDispatch 3. Finance-Bank-ES-INGDirect[0.01] Finance-Bank-ES-INGDirect 4. Finance-Bank-INGDirect [1.05] Finance-Bank-INGDirect 5. GD [2.35] Interface to Gd Graphics Library 6. GD-Barcode [1.15] GD-Barcode 7. GD-Convert [2.12] additional output formats for GD 8. GD-Dashboard [0.04] GD-Dashboard 9. GD-Graph3d [0.63] Creates 3D charts with GD::Graph and GD. 10. GDBUI[0.84] GDBUI 11. GDGraph[1.4308] Produces charts with GD 12. GDGraph-boxplot [1.00] Produces PNG box and whisker graphs 13. GDGraph-Map [1.05] GDGraph-Map 14. GDS2 [2.07] GDS2 15. GDTextUtil [0.86] text utilities for GD 16. SVG-GD [0.07] SVG-GD 17. Template-GD [2.66] GD plugins for the Template Toolkit pm Just need to type install 5 after that search. If after tyring PPM again, you still get no joy, add the Theory5 repository - more details if needed. hth -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: :Graph...crashing...
I found a solution . I ran ppm install http://theoryx5.uwinnipeg.ca/ppms/GD.ppd; as mentioned in http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Repository That solves everything. It's not a bad idea to add Theory5, since Randy who runs it will often build PPMs if you ask nicely using his form on his version of CPAN (linked from www.cpan.org as Koabs search, or something like that.) Im now curious how your search is showing up GD where as my search does'nt. Because I added the repository :) I would not add it but I know and trust Randy and Theory5. Cheers! Lee http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: I need some help with matching something
I need to find every ocuring b.../b blok in a text, even If this ocurs multiple times on 1 line. If you're doing HTML it's worth looking HTML::TokeParser for a quick and easy and generally reliable means of extracting the contents of the 'bold' element: great POD, too -- this is a slightly adjusted version of an example included in the POD: use HTML::TokeParser; $p = HTML::TokeParser-new(shift||index.html); while (my $token = $p-get_tag(b)) { my $text = $p-get_trimmed_text(/b); print $text\n; } Hth -- http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: need info on where can i download the Net-SSH-Perl.ppd
i need to install the the package NET::SSH::Perl and when i try to do that through PPM i get the package not found error. There is no PPD on the ActiveState servers, but you can find one here: http://cpan.uwinnipeg.ca/module/Net::SSH::Perl The link includes docs on how to perform the install. HTH lee http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Perl on external hard drive
...The only thing to watch out for is that you will be violating the ActiveState license if you distribute your own ActivePerl distribution outside of your organization without getting their okay first. However, other people have built Perl for Windows using the AS source, and made it freely available - you could *probably* redistribute that, if you provided the source code and credits. lee http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Use of uninitialized value in concatenation (.) or stringat...
At 20:13 06/09/2003, Devon Young wrote: What does this mean?? I'm thoroughly puzzled and I've been scouring the net for an answer. I've been assuming it means I'm not putting strings together correctly, but I can't figure out how to fix it. Here's the errors I'm getting, followed by the peice of code that the error is apparently in. I can't see what's wrong though. The code looks fine to me... Where did you initialise @_ ? hth lee my $counter = $_[0]; my $x = 1; while ($counter ($_[0]+11)) { # must escape double quotes, so there won't be JS errors. $artist[$counter][5] =~ s//\\/g; # line 120 print BLAH band[$x][1] = \$artist[$counter][0]\\;\n; print BLAH band[$x][2] = \$artist[$counter][1]\\;\n; print BLAH band[$x][3] = \$artist[$counter][2]\\;\n; print BLAH band[$x][4] = \$artist[$counter][3]\\;\n; print BLAH band[$x][5] = \magnet:?xt=urn:sha1:$artist[$counter][4]amp;dn=$artist[$counter][10]amp;xs=http://web1.freepeers.net/uri-res/N2R?urn:sha1:$artist[$counter][4]amp;dn=$artist[$counter][10]amp;xs=http://web2.freepeers.net/uri-res/N2R?urn:sha1:$artist[$counter][4]amp;dn=$artist[$counter][10]\\;\n;; print BLAH band[$x][6] = \$artist[$counter][5]\\;\n; print BLAH band[$x][7] = \$artist[$counter][6]\\;\n; print BLAH band[$x][8] = \$artist[$counter][7]\\;\n; print BLAH band[$x][9] = \$artist[$counter][8]\\;\n\n; $counter++; $x++; } Devon _ Get 10MB of e-mail storage! Sign up for Hotmail Extra Storage. http://join.msn.com/?PAGE=features/es ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Port Scanning (was RE: (no subject))
Please check the archive of perl-win32-users : this was asked and answered yesterday! Please don't cross post to so many groups: this reply to so many is just to save others time. lee
RE: Scanning Port Responce
1. Cross-posting to this many lists is a bit rude. 2. Have you looked around yet? There are many examples of such scripts. It's silly to expect your work to be done for you. 3. Spelling is an important in English as Perl. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of VeeraRaju_Mareddi Sent: 30 May 2001 10:52 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Scanning Port Responce Hi Everybody I wanna scan some specific ports on a remote machine, Whether they are active in state or not. Please provide me basic idea for this to be worked out. If anybody of u have idea ,concept please let me. I wanto this to be Done through perl script. Ur help would be greatful Regards Raju ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users