|
The one-liner should:
solve a real-world problem not be extensively cryptic (should be easy to understand and reproduce) be worth the time it takes to write it (should not be too clever) I'm looking for practical tips and tricks (complementary examples...
Started by J.F. Sebastian on
, 23 posts
by 20 people.
Answer Snippets (Read the full thread at stackoverflow):
perl -e'while(<*.avi>) { s/avi$/srt/; rename <*.srt>, $_ }'
CAVEAT' -> 'movie1.srt....
Sorted by size:
perl -e '%h=map{/.\s/;7x(ord$&&10)+$`,$_}`du -h`;print@h{sort%h}'
I have a list (files with video).
|
|
Inspired by the original thread and the up and coming clones, here's one for the Perl community.
What are questions a good Perl programmer should be able to respond to?
Started by Mark Canlas on
, 18 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Perl implement object orientation? How does Perl's object orientation differ from other languages like C# and Java? Traditional object orientation in core Perl has largely been superseded by what? Why of Perl's greatest strengths....
|
|
What are the popular, contemporary uses for Perl?
Edit
I should have been more specific. I was wondering more on the large scale (popular) what people are using Perl for rather than what it could be used for on the individual level.
Started by T. Stone on
, 15 posts
by 15 people.
Answer Snippets (Read the full thread at stackoverflow):
See skills that are being sought by employers....
Heck, the whole of cpan is a testament to Perl's reusability and encapsulation.
The problem with this question, is that Perl is a very.
And if they can do it in five lines, all the better .
|
Ask your Facebook Friends
|
How can I elegantly print the date in RFC822 format in Perl?
Started by Tom Feiner on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
"\n()->strftime("%a, %d %b %Y %H:%M:%S %z"); use DateTime::Format::Mail; print DateTime::Format::Mail->.
Use POSIX qw(strftime); print strftime("%a, %d %b %Y %H:%M:%S %z", localtime(time())) .
|
|
This is a simple script I have written to test command line argument handling:
use Getopt::Long; my $help = 0; GetOptions( 'help|h|?' => \$help, ) or die "Error!"; print "OK\n";
The results I got are as follows:
D:\>perl test.pl --help OK D:\>...
Started by Andy on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Options may be abbreviated....
This is a feature.
It accepts the shortest non-ambiguious version of the option, so if you had another option "--hex", it wouldn't accept "--he" but it would accept "--hel" .
It is a feature documented here
No, it's intentional.
|
|
On researching another question I noted that the stat function in Perl can take a dirhandle as its argument (instead of a filehandle or filename).
However I can't find any examples of correct use of this - there are none in the Perl manual.
Can anyone...
Started by Alnitak on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
But doingYou....
As a dirhandle, the stat will apply to the file, not the directory:
$ perl -wl opendir $h, "." or die; open $h $h?)
I use Perl 5.10.1 on windows (ActivePerl) and doing stat on a dirhandle doesn't work.
|
|
Hi, I know how to use sed with grep , but within Perl the below fails. How can one get sed to work within a Perl program?
chomp (my @lineNumbers=`grep -n "textToFind" $fileToProcess | sed -n 's/^\([0-9]*\)[:].*/\1/p'`)
Started by Alex Wong on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Anything you need to do with grep or sed can be done natively in perl more/ ? $_[1] : () } $fileToProcess;
Supposedly Larry Wall wrote....
Suggestion: Use Perl regular expressions and replacements instead of grep or sed the extra sed process.
|
|
Where can I find some simple W3C Validator API info for Perl? I've tried looking and just keeps leading to page after page of documentation.
Simply looking for download module or whatever is needed (I am new to Perl but I want to use it for this project...
Started by Phil Jackson on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
On Windows, I'd use Strawberry Perl the platform specific package installer....
On UNIX based systems I would follow the bootstrap instructions for local::lib and then install with cpan WebService::Validator::HTML::W3C .
Install of Perl from.
|
|
I'm trying to use Perl ODBC to connect to a Microsoft SQL server. My problem is that Perl 5.10.0 is having a problem using the Win32 ODBC driver.
If I run a Perl shell and execute this one line, I get errors.
use Win32::ODBC; Can't load '/usr/lib/perl...
Started by Tim Rupe on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Perl reports the error as being # in this perl code simply because this was the last perl code * LPCWSTR; typedef DWORD * LPDWORD; +#endif #if !defined(BOOL) && !defined(_OBJC_OBJC_H_) typedef int.
|
|
When I invoke my Perl scripts in the Windows environment without invoking perl first, the parameters are not passed to my script.
For example,
C:\> C:\my-perl-scripts\foo.pl bar
invokes foo.pl but doesn't recognize bar as a parameter ( @ARGV is empty...
Started by Keith Bentrup on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Try something like:
C:\> ASSOC .pl=perlscript C:\> FTYPE perlscript=C:\....
E' 'f' 'g' 'h' 'j'
I have used pretty much every ActiveState Perl distribution since 2004 command " tells the shell what to do with a Perl script.
|