Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

marto's scratchpad

by marto (Bishop)
on Jun 02, 2004 at 07:58 UTC ( #359256=scratchpad: print w/replies, xml ) Need Help??

#in .bashrc testfunc(){ $(crontab -l|grep -i $1|perl -lane 'print @F[5..$#F]') } alias myfunc=testfunc

command line:

marto@shemp ~ $ myfunc apache no crontab for marto

For Trace On, a short example, it may not be ideal for your unspecified usage case, but perhaps enough to get you going. If this isn't what you're looking for, it's been a long night. Feel free to post in SoPW:

#!/usr/bin/perl use strict; use warnings; # made up data, name/age my %Beatles = ("John", 31, "Paul", 31, "George", 25, "Ringo", 29); # find all matching keys with the value 31 my @matching_ages = grep { $Beatles{$_} eq '31' } keys %Beatles; print ("$_ \n") foreach @matching_ages;

For To_bz:

#!/usr/bin/perl use strict; use warnings; # here you assign the value "index_out" to $Index_File_Name my $Index_File_Name = "index_out"; warn "Index_File_Name: $Index_File_Name"; # here you assign an undefined value to $Index_File_name # it no longer contains what you think it does. $Index_File_Name = shift; warn "Index_File_Name: $Index_File_Name";

Just get rid of the line $Index_File_Name = shift;. See shift or if you want to have a default output file name if the user does not specify one via the command prompt:

#!/usr/bin/perl use strict; use warnings; my $Index_File_Name = shift || "index_out"; warn "Index_File_Name: $Index_File_Name";

If you run this code the first argument will be the file name, if none is provide "index_out" will be the file name.

I've sent a pull request on github to improve the error message returned. On this site we use code tags when posting so that code and data are readable:

<code> Your code goes here </code>

The following are worth reading: PerlMonks for the Absolute Beginner, How do I post a question effectively?.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Corion]: Meh. I get the feeling I should post a call-to-action for people to test their modules with the upcoming 5.26 (or 5.25.latest), as it seems that the smoke testers don't really weed out modules that fail without . in @INC
[Corion]: But without instructions on how to easily test things yourself, I don't think such a call to arms is helpful
[Corion]: (this post on nntp.perl.org / p5p makes it seem to me that smoke testers seem to have a blind spot there)
[Corion]: Hmmm. Maybe setting $ENV{PERL5LIB}=" some path without dot"; perl Makefile.PL; make test already is enough to locally test your module...
[Corion]: Meh, no, will need a BEGIN hook...
[Corion]: ... and PERL5OPT does not like -e in it :-(

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-03-27 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (317 votes). Check out past polls.