On Sun, Sep 7, 2008 at 3:44 PM, Melroy <[EMAIL PROTECTED]> wrote:
> Hi all,
> Is there a perl equiavelnt of the unix time command to find out how
> long
> a given process takes to run?
> google search revealed no help. The only thing I found was the times
> command,
> but I don't think it does what
On Sun, Aug 24, 2008 at 9:29 AM, Ed <[EMAIL PROTECTED]> wrote:
> On Aug 21, 8:32 am, [EMAIL PROTECTED] (Yitzle) wrote:
>> On Wed, Aug 20, 2008 at 7:37 AM, Ed <[EMAIL PROTECTED]> wrote:
>> I might be way off here, but wouldn't it make sense to use the CPAN
>&
On Thu, Aug 21, 2008 at 1:08 PM, Periklis <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have the following problem:
> Trying to install a module through the CPAN utility, I got an error message
> of not having the right to acces some directories and the installation failed.
>
> My question is how sho
On Wed, Aug 20, 2008 at 7:37 AM, Ed <[EMAIL PROTECTED]> wrote:
> Howdy all!
>
> As part of a test script, I have to make sure my test machine (i.e.
> the machine that is running the script) has libraries zlib and hdf5. I
> do that with this code. Is there a better way?
>
[snip]
>
> Any comments app
On Tue, Aug 19, 2008 at 10:39 AM, Jyotishmaan Ray <[EMAIL PROTECTED]> wrote:
> I would need it in a different server to create all the home directories.
>
> Kindly provide a different script for that.
There are websites out there that allow you to hire someone to work on
a project for you...
--
On Fri, Aug 15, 2008 at 6:42 AM, Graeme McLaren
<[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> Just wondering, would it be possible to do a banner rotation in perl without
> refreshing the page? Could this be done using Ajax?
>
>
> Thank you,
>
>
> Graeme
This has absolutely nothing to do with Perl.
On Mon, Aug 11, 2008 at 5:02 PM, DeeDee Messersmith
<[EMAIL PROTECTED]> wrote:
> I have strings such as the following:
>
> .INSERT,SCREW THREAD..
>
> I need the leading dots but not the trailing. As you see it has commas and
> spaces in it so the traditional \w doesn't work. the .* doe
On Mon, Aug 11, 2008 at 11:40 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> yitzle wrote:
>> On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote:
>>>
>>> I am trying to make hash that refers to itself like this
>>>
>>> my %
Not the way you are doing it. This would work, though:
my %_HASH;
%_HASH = (
typeOne => {
root => '/path/to/typeOne',
logfile => $_HASH{typeOne}->{root}.'/logone.log';
},
typeTwo => {
root => '/path/to/typeTwo',
logfile => $_HASH{typeTwo}->{root}.'/logtwo.l
On Wed, Aug 6, 2008 at 4:29 AM, Kenneth Brun Nielsen
<[EMAIL PROTECTED]> wrote:
> Within a perl program, I want to go to a particular mode when a
> keyword is found. The keyword is a regexp.
>
> E.g.
> #!/usr/bin/perl -w
> open FILEHANDLE, "soatest.soa";
> while (){
>if (/^\*| XI/) {
>p
On Thu, Jul 24, 2008 at 1:02 AM, Noah <[EMAIL PROTECTED]> wrote:
>
>>
>> Untested code.
>>
>> # Always...
>> use strict;
>> use warnings;
>>
>> my %ip = ...;
>>
>> #Get the lines as an array.
>> my @lines = keys %ip;
>>
>> # Slight modification to the regex. Someone else's reply will probably
>> ha
On Thu, Jul 24, 2008 at 12:44 AM, Noah <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> okay I have a strange issue. all the lines as part of "my @lines = keys
> %ip;" have a space at the beginning of the line of each key.
>
> cheers,
>
> Noah
Without knowing how %ip was formed or how you are decidin
On Thu, Jul 24, 2008 at 3:59 AM, Noah <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I loaded a bunch of configuration lines into a hash called $Input
> now I am searching the hash to make sure specific lines are there.
>
> I want to print "NO" unless there is a match to the following ""check $ip
> h
On Fri, Jul 18, 2008 at 9:37 AM, Manasi Bopardikar
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> Does anyone know details about find_all_links method of the mechanize
> module.
I'd say the CPAN page explains it pretty well...
Rather than copy/pasting a huge chunk of text, see
http://search.cpan.org/~petd
No one here believes in the CygWin package?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Wed, Jul 16, 2008 at 9:01 PM, <[EMAIL PROTECTED]> wrote:
> Hi experts
> When I am using STDERR and STDOUT for mixed output, I found a problem.
> Output of STDERR and STDOUT can not be mixed.
> Here is the snippet.
>
> #
> print STDOUT "This is STDOUT\n";
> pr
On Mon, Jul 14, 2008 at 2:36 PM, ChrisC <[EMAIL PROTECTED]> wrote:
> Is it possible to access gmail from perl? If so, how would you go
> about it?
>
> Thanks,
>
> Jerry
You might want to start by searching CPAN for Gmail modules:
http://search.cpan.org/search?query=gmail&mode=module
--
To unsub
On Thu, Jul 10, 2008 at 7:44 AM, Amit Saxena <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I want to know how to get the count of number of rows returned in delete /
> update sql in Perl DBI ?
>
> I have ready some articles on the internet and it states that the "execute"
> function returns the number o
On Wed, Jul 9, 2008 at 9:22 AM, luke devon <[EMAIL PROTECTED]> wrote:
> Hi
> I am storing IP in to a varable , $ip="172.22.8.10 \-";
> but i wanted to filter out only the ip . how can i do that ? please help
> Thank you
> Luke
$ip =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/;
$ip = $1;
Or you can u
On Wed, Jul 9, 2008 at 2:30 AM, Thomas Bätzler <[EMAIL PROTECTED]> wrote:
> NULL is a SQL term. The Perl equivalent is undef, i.e.
>
> $x = undef;
NULL is used far more widely than in just SQL; it is used in C/C++,
Java, Visual Basic and I'm sure many many more.
--
To unsubscribe, e-mail: [EMAIL
On Wed, Jul 9, 2008 at 12:44 AM, luke devon <[EMAIL PROTECTED]> wrote:
> Hi
>
> How can we define NULL values in perl ? for instance if I wanted to assign a
> NULL value for a variable called "$x= , how would it be in the code ?
>
> Thank you
> Luke
The closest Perl has to NULL is undef. Or maybe
On Thu, Jul 3, 2008 at 9:47 PM, yitzle <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 3, 2008 at 11:03 AM, Roy M <[EMAIL PROTECTED]> wrote:
>> Conside the following codes:
>>
>> use POSIX;
>>
>> print LONG_MAX, "\n";
>>
>> my $num = 99
On Thu, Jul 3, 2008 at 11:03 AM, Roy M <[EMAIL PROTECTED]> wrote:
> Conside the following codes:
>
> use POSIX;
>
> print LONG_MAX, "\n";
>
> my $num = 994;
> print $num;
>
>
> Why $num is bigger than LONG_MAX ?
It is a string maybe?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addit
On Thu, Jun 26, 2008 at 5:22 PM, <[EMAIL PROTECTED]> wrote:
> Hi Yitzle:
>
> Thank you very much for your suggestion:
>
> Here is my perl file: clusters.pl
>
> #! /usr/bin/perl
> use warnings;
> use strict;
> while (my $line = <>) {
> $line = ~/clust
On Thu, Jun 26, 2008 at 3:28 PM, Erasmo Perez <[EMAIL PROTECTED]> wrote:
> Hi dear list:
>
> Thank you very much for you great help in solving my past issue,
> regarding the removing of the trailing commas and points.
>
> Thank you very much indeed :-)
>
> Now, my last (I hope) issue.
>
> I got ano
On Thu, Jun 26, 2008 at 1:14 PM, <[EMAIL PROTECTED]> wrote:
> Hi dear Jeff:
>
> Thank you very much for your help
>
> Yiur script is working flawlessly
>
> Just another question:
>
> How could I re-write your script in order to treat the __DATA__
> portion of your code as an external file ?
>
> I
Sorry for the multiple replies... This code works. Though I think I
might be doing something "bad". When I comment out the line:
$curNode->{ $nodeName }{ '__PARENT__' } = $curNode;
after the loop, %root is an empty hash. I'm not sure why.
#!/usr/bin/perl
use strict;
use warnings;
use Data::D
This code is a start. It needs some playing with, still.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
open my $FH, "< t" or die;
my %root = ();
my $depth = 0;
my $curNode = \%root;
while ( my $line = <$FH> )
{
chomp $line;
$line =~ /^(\s*)/;
my $leadingSpace = lengt
On Thu, Jun 26, 2008 at 9:57 AM, Pat Rice <[EMAIL PROTECTED]> wrote:
> Hi all
> I'm wondering if there is a nice way to parse this data, as in is
> there any module that could handle this type of data, as in the was it
> is presented? so that I can repeat is itn a tree like structure in
> HTML ?
>
On Thu, Jun 26, 2008 at 11:00 AM, Li, Jialin <[EMAIL PROTECTED]> wrote:
> another way to handle the one line input is to read the whole line at once
> and then use
> regex to extract each column
>
>
> __CODE__
> #!/usr/bin/perl
> use strict;
> use warnings;
> my $label_file = "label.in";
> my $thic
On Thu, Jun 26, 2008 at 8:18 AM, vikingy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have two files,one is label file,another is thickness file, they are one
> to one correspondence, for example:
> the label file is : 2 2 3 2 1 3 4 5
>2 5 1
On 6/22/08, Pad <[EMAIL PROTECTED]> wrote:
> Need your help again!
>
> I have a file that contains several _begin and _end classes with
> _begin is that start of the block and _end being the end of block.
> Sometimes we miss either _begin or _end. I am trying to write a
> script that find ever
On Fri, Jun 20, 2008 at 3:10 PM, Ravi Malghan <[EMAIL PROTECTED]> wrote:
> Hi: I am trying to extract some stuff from a string and not getting the
> expected results. I have looked through
> http://www.perl.com/doc/manual/html/pod/perlre.html and can't seem to figure
> this one out.
> I have a s
On Thu, Jun 19, 2008 at 1:57 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Do more simple and whit out numbers, some times the $1 .. are special
> vars
>
> while () {
> ($v1,$v2,$v3,$v4)=split(/,/,$_);
> print "$v1\n";
> print "$v2\n";
> print "$v3\n";
> print "$v4\n";
> print "\n";
On Wed, Jun 18, 2008 at 8:12 PM, dakin999 <[EMAIL PROTECTED]> wrote:
> Hi, I am trying to write the script myself and now stuck at some
> thiong that I am pretty sure have been done by others. Any help will
> be significant.
>
> Ok, I have created an array and now I want to read from this array the
Always:
use strict;
use warnings;
On Thu, Jun 19, 2008 at 6:10 AM, dakin999 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have following code which works ok. It does following:
>
> 1. reads data from a input file
> 2. puts the data into seperate variables in a array
> 3. reads from this array and prints
On line 58... Wait! You only got 47 lines. How does line 62 have an error?
The last subroutine starts off:
sub {
Giving it a name ought to fix it all up, I think.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Fri, Jun 6, 2008 at 11:32 AM, Richard Lee <[EMAIL PROTECTED]> wrote:
> zentara wrote:
>
> I was just listening to podcasting and I heard Chad Fowler("my job went to
> india: 52 ways to save your job) talking about programming language
> in general.
> One of the quotes he says that I felt like it
Whee! Inflammatory topic!
1) If you are interested in learning to program for the sake of
programming (vs getting XYZ done), Perl probably isn't the best first
choice. (Not that its the last choice or anything, but not first.) I'd
personally advocate C/C++ or maybe Java. Maybe make Perl a third
ch
On Thu, May 22, 2008 at 8:57 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> Shouldn't perl disallow defining the $text variable a second time in the same
> script if using "use strict"?
I'm going to venture to answer "no".
However, if you 'use warnings', it will warn you.
--
To unsubscribe,
See:
http://search.cpan.org/~petdance/WWW-Mechanize-1.34/lib/WWW/Mechanize.pm#$mech-%3Ecredentials(_$username,_$password_)
$mech->credentials( $username, $password )
Provide credentials to be used for HTTP Basic authentication for all
sites and realms until further notice.
The four argument form
Take a look at WWW::Mechanize, specifically the submit_form() function.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Tue, May 6, 2008 at 10:43 AM, Rodrigo Tavares
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> I create a hash, and i want take the keys.
> Using Deitel Book, i take this example:
>
> numbers =
> (
>1 => 'one',
>3 => 'two',
>5 => 'three',
>7
On Tue, May 6, 2008 at 9:49 AM, Robert Hicks <[EMAIL PROTECTED]> wrote:
> Is there anything wrong with:
>
> if ( defined $one && defined $two && $one eq $two ) {
> do something
> }
No. Its fine.
You might be interested in "Operator Precedence and Associativity" [1]
[1] http://perldoc.pe
I'm sure someone more experienced will have a far more elegant
solution, but something along these lines might work.
(Note: code untested)
%count;
while (<>) {
if ($_ =~ /^"([^"]*)"/) {
%count{$1}++;
}
}
for (keys %count) {
print "$_ - $count{$_}\n";
}
or, refractored,
%count;
while (<
On Thu, Apr 10, 2008 at 4:35 PM, Jonathan Mast
<[EMAIL PROTECTED]> wrote:
> Thanks for all the input.
>
> The head / tail solution would work, but isn't very scalable. I did
> something similar on another file of comparable size and it took a long time
> to complete.
>
> The line numbers are 4
or use sed!
To print lines 5 through 10:
sed -ne '5,10p'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Fri, Apr 4, 2008 at 8:46 AM, <[EMAIL PROTECTED]> wrote:
> Hi
>
> I am trying to regex a make output line (g++) and don't get it together.
> What I want is:
>
> All lines where the -c option does not occure, neither before nor after the
> -o option and then
> extract the portion after the -o
Huffman encoding is basically the idea that the more often a symbol is
used, the shorter it should be.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
I'm just guessing here, but I'm going to suggest that both methods
ultimately call the same code and are therefore equivalent. Though the
cpan command takes arguments, so it might speed stuff up.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http:
http://perldoc.perl.org/functions/system.html
... the parent process waits for the child process to complete.
The return value is the exit status of the program as returned by the wait call.
You want to first fork and run the command in its own thread.
http://perldoc.perl.org/functions/fork.html
I haven't learned AJAX yet (hopefully this summer), but I don't think
you can do it exactly as you have envisioned.
The CGI/Perl script runs on the server and produces some static HTML
code which contains the AJAX. The script finishes. The HTML is sent to
the browser. The browser then renders the H
On Tue, Apr 1, 2008 at 4:03 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> yitzle wrote:
> > Is there some way to convert it (a string/scalar) to an array?
>
> Is this what you mean?
>
> my $string = 'ABCDEF';
> my @string = split '', $string;
&g
Is there some way to convert it (a string/scalar) to an array?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
> my $sepchar = grep( /,/ => @_ ) ? ";" : ",";
> And I also don't understand what ";" is doing in the ternary operator??
The ";" is what is returned if the condition is TRUE.
"( / ,/ => @_)" is a(n anonymous) hash. I've had no idea that grep can
operate on a hash.
However, it seems that "grep( /
To get the date of a file:
perldoc stat
http://perldoc.perl.org/functions/stat.html
For moving files:
http://perldoc.perl.org/perlfaq5.html#How-can-I-reliably-rename-a-file%3f
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Text files don't /have/ "pages". The number of lines per page depends
on the printer driver -> the font size, margin size, etc.
If you know the number of lines the print driver does per page, you
can fill to that point with newlines based on the number of lines
already outputted.
Or you might be in
Um. No offense, but can you double check that the same exact code is
being ran against both versions?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
1) If it doesn't work in wget, you're doing something wrong.
2) You want the Perl LWP/Mechanize module. (Mechanize works on top of
LWP and does much more than you need, but I like it ;) )
3) Clicking the link in a borwser opens a webpage for me, not
downloads a file. The download starts a bit later
Have you tried it?
Grep does return the result lines when used in a list context, ie how
you used it
> @inmhs = grep(/$line/,@mhsArray);
print "$_\n" for (@inmhs);
>From Perldoc:
"Evaluates the BLOCK or EXPR for each element of LIST (locally setting
$_ to each element) and returns the list value
If there is a header row that describes what is in each column, you
can use the contents of that column's header as a hash key...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
1) Can you set a really long timeout?
2) When I asked about doing something similar with Mechanize->get(),
someone suggested wrapping the call in an eval block and testing the
exit status of the function call. Or something like that. Would that
approach work here?
--
To unsubscribe, e-mail: [EMAI
IIRC, Perl does not let you use a string to build a variable name like PHP does.
If you do this:
$myVar = 123;
$varName = "myVar";
print "$varName";
You get "myVar" and not "123" which seems to be what you want.
However, I think you might be able to use hashes and get what you want.
$hash{"
On Mon, Mar 24, 2008 at 9:00 AM, <[EMAIL PROTECTED]> wrote:
> Hi ,
> Looking at the reg expression ( $playercard1 =~ /10|J|Q|K/ ),
> it will match 0, 1, and '10' , J, Q, K
>
> What must I do so that it will match only '10' , 'J', 'Q', and 'K'
>
> Thanks
/10|J|Q|K/ will not match 0 or 1 alone.
Arguments are passed in the @ARGV array.
You can access $ARGV[0] and $ARGV[1]
unless (defined $ARV[0] and defined $ARGV[1]) {
die "You need to supply two arguments\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Perl got several graphical toolkits, notable Gtk+, Tk and Wx.
I get the impression that Tk is one of the more popular ones.
Alternatively, if you only need it once you might want to simply embed
a shell/system command in Perl to activate the dialog and read the
return values. But, to avoid gettin
I think you want:
if( defined $q->param('action') ) {
} else {
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Mon, Mar 17, 2008 at 7:12 AM, <[EMAIL PROTECTED]> wrote:
> Are subs always return references or only for anonymous lists/hashes?
perldoc perlsub
"The Perl model for function call and return values is simple: all
functions are passed as parameters one single flat list of scalars,
and all funct
On Sun, Mar 16, 2008 at 12:54 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> >> push @records, %record
> > I think you want an array of references, not of hashed themselves.
>
> Actually, the hash is converted to a list and that list is pushed onto
> the array.
>
>
> John
Darn! I tested it us
Always start your code with:
use warnings;
use strict;
> my %record = r();
This line won't work. r() returns a reference (think pointer if you
used C) to a hash. You need a scalar to store it.
$record = r();
> $record{fieldA}{fieldB} = value...
This requires a hash, unlike the above line that use
On Sun, Mar 16, 2008 at 12:20 AM, <[EMAIL PROTECTED]> wrote:
> Hi, Members
> The script below produce an error at the printf function at line 342 which
> says "Illegal division by zero at \perl\baccarat.pl line 342.".
> Can someone tell me whats wrong.
> Thanks
>
> partial script=
You want to start the code with these:
use warnings;
use strict;
> if(/,/) {print "before match: $`\t and after match: $'\n\n";};
> $x=$';
> $y=$`;
> &mysubroutine($x,$y);
Should be:
if(/,/) {
print "before match: $`\t and after match: $'\n\n";
$x=$';
$y=$`;
mysubroutine($x,$y);
}
No ';' a
On Wed, Mar 12, 2008 at 11:41 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
> Well, the one of the reason that I have been avoding using the modules
> was that I wanted to understand what the hell I am using.
>
> And I read somewhere that reading what others have wrote is among the
> best way to l
I've been avoiding modules somewhat, too.
However, you don't really need to be that familiar with OO to learn to
use the modules.
Are you trying to read the module's code to learn about them? Most
people just use the documentation on CPAN.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addition
If you are using Unix and don't necessarily want it done via a Perl
script, you can just use the cat command.
cat -n
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Sun, Mar 9, 2008 at 6:13 AM, <[EMAIL PROTECTED]> wrote:
> ok, this is what I have tried but I got and internal system error msg like
> this "An internal system error has occurred which prevents us from
> responding to your request. "
> - start of script--
> use Algor
On Sun, Mar 9, 2008 at 12:54 AM, <[EMAIL PROTECTED]> wrote:
> Hi,
> I wish to use the module "shuffle" from cpan.
> I have downloaded perl to c:\perl
> so where do I install the module to?
> thanks
If you are using ActiveState Perl, there should be some PMM or PPM
tool it installes. (Perl Mod
On Thu, Mar 6, 2008 at 10:50 AM, yitzle <[EMAIL PROTECTED]> wrote:
> I don't know much about how Perl deals with this stuff, but what
> you've done is made a copy of the pointer/reference.
> Both variables are referencing the same memory/hash.
> What you want to d
I don't know much about how Perl deals with this stuff, but what
you've done is made a copy of the pointer/reference.
Both variables are referencing the same memory/hash.
What you want to do is copy the hash, not copy the reference to it.
I /think/ this ought to work:
my %hash = %{$fileSize};
__CO
On Tue, Mar 4, 2008 at 10:35 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> A terminal that can handle UTF-8.
>
> You may need to put this in your profile
> #fix UTF-8 support
> export LC_CTYPE=en_US.UTF-8 #vim needs this to swtich it from Latin1 to UTF-8
> export PERL_UNICODE=SDL #Makes Per
On Tue, Mar 4, 2008 at 8:29 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> Nope, due to addition of Unicode support in recent versions of Perl it
> will also match "\x{1814}" the Mongolian digit 4. The \d character
> class is not the same as [0-9], it matches all number characters,
> including t
Andrew has got a good point. The perldoc page says:
if (/^\d+$/) { print "is a whole number\n" }
which would indicate that the author of the perldoc page believes
"123\n" should classify as a number, while "123foo" shouldn't, even
though Perl sometimes treats "123foo" as a number.
I was going to
This approach does not consider "0" to be an integer.
I'd use a RegEx and test to see if the string is made up entirely of integers.
print "The variable containing $p is an interger\n" if ($p =~ /^[0-9]+$/);
On Tue, Mar 4, 2008 at 3:19 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/pe
I think both in sed and perl you can use any symbols you wish to delineate
the RegEx. # works, but / is traditionally used in Perl.
That is to say, in Perl these two lines are the same:
$in =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/;
$in =~ s#C:\\Dir 1\\Dir 2\\Dir with more spaces#re
How about providing the code that you are working with?
This ought to work:
s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/
__CODE__
$in = 'C:\Dir 1\Dir 2\Dir with more spaces';
$in =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/;
print "$in\n";
__OUTPUT__
replacement
On Thu, Feb 21, 2008 at 10:35 AM, Yoyoyo Yoyoyoyo <[EMAIL PROTECTED]> wrote:
> But the commands do still run in the command line, is there anyway to throw
> a perl variable in there?
Yes. You did it correctly. Look at the code I posted.
> my $y = `echo $x`;
--
To unsubscribe, e-mail: [EMAIL PROT
Perl captures the output from backticks so nothing gets printed to the screen.
__CODE__
my $x = "efg";
my $y = `echo $x`;
print $y;
__OUTPUT__
efg
__END__
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Suggestion: rather than use egrep (which, as Chas points out, requires
a new process - and ignoring his solution for a moment - sorry), it
might make more sense (and increase portability) to move the RegEx
parsing into Perl.
my $var = grep {/This|That/}, `cmd --arg1 --arg2;
(Did I do this right? I
On both Windows and Unix, there are two output streams, STDOUT and STDERR.
The backtick operator captures the STDOUT and lets you use it eg to set $var.
STDERR is what you are seeing. (Perl's warn prints to STDERR)
What you can do (on Linux machine) is redirect the STDERR to null.
I don't think egr
I don't know... maybe I /was/ looking at the C code.
The code Chas provided does look fairly similar to the Tk code.
Thanks for the replies. I guess I'll be using GTK2 after all :D
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.or
You can use Perl's sort to sort the data in Perl and regenerate the table.
Or you can use some Javascript table widget. Try Googling for
"Javascript table" or "Javascript table sort".
Some hits I found:
http://www.joostdevalk.nl/code/sortable-table/
http://www.workingwith.me.uk/articles/scripting/s
Hi
I decided throwing a GUI on Perl would be fun so I want to make a Connect Four.
Which GUI module would you advise? It seems the major contenders are
GTK, GTK2/GTK+ and Tk.
Tk seems to have the simplest interface which is nice, but it sure
doesn't look as pretty as GTK.
I took a peek at the GTK+
On Feb 18, 2008 10:50 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote:
> Just use Python *ducks*
> --
> Rodrick R. Brown
> http://www.rodrickbrown.com
/me gets out the hunting rifle... :P
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.per
What are you trying to do?
$ time perl -e 'print "$_\n" for (1..100);'
That takes about 5 milliseconds on my ultra-fast PC. 100 loops. 5 milliseconds.
A second per loop? You can slow it down if you want to...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL P
To reuse some code...
$ perl -le'
$_ = "D.PRS.WEB.02.10.001.1";
print;
s/\.[^.]{0,2}\z//;
s/\.[^.]{4,}\z//;
print;
'
Will replace 0 to 2 or more than 3 characters with ""
To get digits and not "any character except a dot(.)" replace "[^.]"
with "[0-9]" or the equivalents: "\d" and "[:digits:]"
-
I'm not sure how it works, but I think <> or \<\> is a RegEx reserved
character for word matching.
Aside from that, consider using [^<]* and [^>]* in place of .*
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Windows does not support the "links" that Unix has.
Windows links have a .lnk extension that you can check for.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
http://perldoc.perl.org/perlfaq4.html#How-do-I-find-the-day-or-week-of-the-year%3F
You can extract the -MM-DD with a simple RegEx (untested code):
$str = q/Timestamp : '2008-01-17 10:24:00'/;
my ($year, $mon, $day) = ($str =~ /\'([0-9]{4})-([0-9]{2})-([0-9]{2})/);
--
To unsubscribe, e-mail:
Why do you only have one double-quote on that line?
Are you using strict and warnings?
print $query->redirect(-location=> "test.cgi?ID=$value", -method=>"GET");
On Jan 22, 2008 4:31 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
> Hopefully this appropriate question for this group. I am
See http://perldoc.perl.org/functions/delete.html
Generally speaking (ie yes, there are exceptions), there is no reason
to ever want to delete a variable.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
1 - 100 of 317 matches
Mail list logo