--- Ela Jarecka <[EMAIL PROTECTED]> wrote:
> Hi folks,
> I have a couple of doubts/questions about the usage of above
> functions:
>
> 1. will those three always work the same ( I have troubles
> understanding the
> 'die' description in Llama book ( $!, $?>>8, the status of the last
> reaped chi
--- "F.H" <[EMAIL PROTECTED]> wrote:
> I just wonder why the if condition is always true regardless of the
> value of the array AB.
> if ($testsec{'AB'}[$i] = "6543"){ # always true
Because = is an assignment. =o)
print "foo" if $x = "65343";
will always print, because = retu
--- Paul <[EMAIL PROTECTED]> wrote:
>
> --- "F.H" <[EMAIL PROTECTED]> wrote:
> > I just wonder why the if condition is always true regardless of the
> > value of the array AB.
> > if ($testsec{'AB'}[$i] = "6543"){
--- Mike Ring <[EMAIL PROTECTED]> wrote:
> I've learned a bit about regular expressions today. I have a string
> formatted
> like "CN=foo,OU=bar,O=pah" and I need to parse out "foo". I have
> created the
> following code which does work:
>
> $dnvalue =~ m/([^,]*)/;
> $username = $1;
> $username
--- Me <[EMAIL PROTECTED]> wrote:
> > I have a file having 100 lines.
> > I want to remove the lines, having a particular string, completely
> > from the file. (notreplacing them with blank lines even)
> >
> > Is there a way in perl for doing this ?
>
> At a shell prompt / command line, enter:
>
--- "F.H" <[EMAIL PROTECTED]> wrote:
> Hi all,
Hi. =o)
> I am trying to skip any line in my input file that doesn't have a
> city with a street named 'MAIN'. I am matching record[3] in my input
> file with a $city (array) from a hash (%state) that I got from
> another file. The problem is that
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote:
> > > $city = $record[3] ;
> > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) {
> >
> > Never use the
> > for( ; ; ) { }
> > constru
File" or die "$outFile: $!";
my $fhPIPE = new FileHandle "ls -l|"or die "ls: $!";
my $rec = <$fhIN>;
my $line = <$fhPIPE>;
print $fhOUT $rec;
Paul
=
> Ela Jarecka wrote:
> >
> > Hi,
> > It is decla
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> > for my $i (0 .. $#foo) {
> > my $element = $foo[$i];
> > # ...
> > }
>
> or
>
> for (my $i = 0; $i < @foo; $i++) {
> ...
> }
>
> for (;;) isn't a bad word. :)
lol -- depends on where you were raised. ;o]
_
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> Is there a perl variable that automatically counts loop iterations.
> Such that I don't have to use '$count':
>
> foreach (@array){
> $count++;
> ..whatever..
> }
Lot's of people with suggestions, but I have a question --
what are you using $coun
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> Within the loop, some other programs are executed and occasionally it
> may take a few minutes to complete everything and then continue. So
> I'm just throwing a little counter to STDOUT so I can monitor the
> progress, to ensure it doesn't get hung up
718000
718000
718000
734000
734000
734000
See, a sudden increase of 16000 us in the middle of the same loop.
Can anyone explain this?
Thanks,
Paul
Global WebMail -
Delivered by Global Internet www.global.net.uk
--- "Seitz, Scott" <[EMAIL PROTECTED]> wrote:
> I'm having trouble with what I think is a very simple split question.
>
> I've got a line of text something like:
>
> DimView 1 "All" DimView 2 "Some" DimView 3 "Most" DimView 4 "None"
>
> I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "N
--- Me <[EMAIL PROTECTED]> wrote:
> > > my ($num) = @_;
> > >
> > > puts the length of @_ in $num.
I don't think so?
The parens should give $num a list context.
It should have the first value in @_.
Right?
__
Do You Yahoo!?
Get personaliz
--- Martin van-Eerde <[EMAIL PROTECTED]> wrote:
> could you walk me through @h{@vars} = ()
> I think it means many keys of the hash will be assigned an
> undefined list.
> I dont understand the @ meaning array in @h !!
> > my %h;
> > @h{@vars} = ();
> > if (keys %h != @vars) { $youlose = "yes" }
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote:
> > "Silvio" == Silvio Luis Leite Santana <[EMAIL PROTECTED]>
> writes:
>
> Silvio> Hi all
> Silvio> The camel-book and perldoc-page says about "open":
>
> Silvio> You may also place a + in front of any of these three
> Silvio> modes t
e no delimeters.
Of course, I could just test the length and then use substr it all out, or even
sprintf it into a new variable with a pad at the first character.
But this is perl, and I reckon there are much cooler ways to do it.
Any takers?
Paul.
---
My hash has keys that are dates in "ddmmm" format (21Jul2001).
I would like to sort the hash by date.
So as I understand it:
keys %dates
should return an array with the dates in. I can't sort that directly as it is a date,
so I was thinking that I could split the date out and timel
nth, and four for the
>year.
>>
>> So I would like to split out the day, month, year, and am interested in
>splitting techniques, where there are no delimeters.
>>
>> Of course, I could just test the length and then use substr
Hmm... this used to work in old dos:
cls > clear.txt
type clear.txt
This would clear the screen. Now you just get an ascii representation of the clear
code.
Does this mean than that you cannot clear the screen in Win32 just by printing an
ascii sequence?
Or perhaps we need
device=c:
t it
into the loop. Or perhaps I shouldn't.
Can you help further?
Thanks,
Paul.
In reply-to [EMAIL PROTECTED] on Tue Jul 3 15:59:15 2001
>On Jul 3, [EMAIL PROTECTED] said:
>
>>My hash has keys that are dates in "ddmmm" format (21Jul2001).
>
>The date f
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> On Jul 3, John Edwards said:
>
> >It's messy and relies on you naming you subroutines to match the
> static data
> >stored in %funcs. It will introduce more possible points of failure
> in the
> >code, make it harder to debug and maintain. Unl
--- Pozsar Balazs <[EMAIL PROTECTED]> wrote:
> > The => (fat arrow) auto-quotes the left-hand operand as long as
> it's a
> > bareword.
> >
> > foo => 'bar'
> >
> > is the same as
> >
> > 'foo' => 'bar'
>
> And are they the same as:
>
> "foo" => "bar"
> 'foo' => "bar"
> ...
> and so on?
--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> On Jul 3, Paul said:
>
> >> > foo => 'bar'
> >> > 'foo' => 'bar'
> >>
> >> And are they the same as:
> >>
> >> &q
--- Pozsar Balazs <[EMAIL PROTECTED]> wrote:
>
> hi again,
>
> I get this warning:
> Reference found where even-sized list expected at ./n.pl line 94.
It usually means you're using {} instead of () to assign hash values.
=o)
> when running my script, and i don't understand what does it mean.
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote:> use
strict;
> my @stretch;
> while (<>) {
> my ($line, $val, $char) = split;
> if ($val < 1) {
> push @stretch, $char;
> }
> if ($val >= 1 or eof()) {
> if (@stretch >= 9) {
> printf
can see you to work out who's messages are who's would be to issue a
Top 1
This returns the headers of each message. From those you could analyse and count the
message for each user.
Cool?
Paul.
-
"Gross, Stephan"
right fields for munging?
I can think of a number of ways I would do this in other languages, but any tips on
the ways of Perl would be excellent.
Thanks,
Paul.
Global WebMail -
Delivered by Global Internet www.global.net.uk
In reply-to Michael Fowler <[EMAIL PROTECTED]> on Mon Jul 9 13:06:42 2001
>On Mon, Jul 09, 2001 at 12:26:48PM +0100, [EMAIL PROTECTED] wrote:
>> I have a text file produced by another system. The fields are semi-colon
>> delimited, and the first line is a list of the fields, a header record,
>>
--- Matija Papec <[EMAIL PROTECTED]> wrote:
> I'm curious which of the two examples is more preferred or it depends
> entirely on someone style?
>
> $x = 1;
>
> #1)
> if ($x) { $x = 0 }
> #2)
> $x = 0 if $x;
>
> IMO first is more convenient and orthodox but tha
--- dave hoover <[EMAIL PROTECTED]> wrote:
> Paul wrote:
> > On Mon, Jul 09, 2001 at 09:44:57AM -0700, dave
> > hoover wrote:
> > > I think it's a matter of style, but also one
> > > should consider who will be maintaining this code in the
> > &g
--- Govinderjit Dhinsa <[EMAIL PROTECTED]> wrote:
> I have a input file which is a fixed line file (all along one line,
> no " \n or \r ").
> ##
> Q. How would I separate each data type, to do the following;
>
> At @fields
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I sent an email yesterday, but never heard anything. Maybe it was the
> word 'php' in the subject, but let me just simplify and ask another
> way.
>
> Is there a way to automatically direct all STDERR output to STDOUT. A
> module I have in
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> > Does anybody know why he shouldn't do the following?
> >
> > *STDERR = *STDOUT;
> >
>
> This is what I orignally tried, and is didn't really work. I think my
> problem lies in the fact that I am hoping to make the change in a
> module that I am 'u
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> > Are you sure it's STDERR? Some write directly to ther terminal
> > screen...
>
> I checked through the module code and it definitely says 'print
> STDERR ...'.
Well, unless they've done some shinanigans further up the code, that's
pretty conclusive
Okay, we recently had a discussion of
open THIS, ">&THAT"
and
*THIS = *THAT
Doesn anybody know the difference?
Especially if you use STDERR and STDOUT instead of THIS and THAT?
Just trying to understand the underlying behavior.
=
And on a seperate note, if Perl6 isn't going to u
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> As mentioned eariler...
>
> --- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote:
> You mentioned in the earlier email that you were calling your perl
> script
> via 'exec' (as I remember).
> Could you not use something like
> exec(' myperl.pl 2>&1
--- Paul <[EMAIL PROTECTED]> wrote:
>
> --- Bob Mangold <[EMAIL PROTECTED]> wrote:
> > As mentioned eariler...
> >
> > --- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote:
> > You mentioned in the earlier email that you were calling yo
--- "P. Schaub" <[EMAIL PROTECTED]> wrote:
> I am calling a perl script within another perl script.
Have you looked into require() and do()?
> What is the best way to pass arguments to the second one ?
Depends on what you want, what it does, and how it's written.
> Is it possible to pass arra
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 10, 2001 at 09:43:26AM -0400, Sparkle Williams wrote:
> > I'm having two problems
> > 1) Is there an equivalent of the case function in Perl?
>
> perldoc -q switch, or
Check out Damian Conway's Switch module.
http://search.cpan.org/doc
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 10, 2001 at 10:19:43AM -0700, Paul wrote:
> >open THIS, ">&THAT"
>
> This dups (see man 2 dup) fileno(THAT) and opens it with the
> filehandle THIS. The THIS and THAT filehandles now refe
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 10, 2001 at 10:28:14AM -0700, Paul wrote:
> >
> > --- Paul <[EMAIL PROTECTED]> wrote:
> > >
> > > --- Bob Mangold <[EMAIL PROTECTED]> wrote:
> > > > exec(' myperl.p
--- Matija Papec <[EMAIL PROTECTED]> wrote:
> Btw, when we talk about structures is there something like switch in
> perl which could replace following code?
>
> $x==1 and $y = 1;
> $x==2 and $y = 2;
> $x==3 and $y = 3;
I mentioned Damian Conway's Switch.pm earlier today:
use Switch;
my $x
--- Pedro A Reche Gallardo <[EMAIL PROTECTED]> wrote:
> Hi all,
> Is it possible to delete an array element changing the array size at
> the same time?
> if I do $array[$i]= undef; the value is gone but the size of the
> array remains the same?!
see perldoc -f splice:
splice ARRAY,OFFSET,LENGT
--- Bob Bondi <[EMAIL PROTECTED]> wrote:
> Thanks for the feedback, everyone.
> My goal for this script is to make "this.gif" and "that.gif" change
> places in the file. I.E.
> -
> this.gif
> that.gif
> this.gif
> -
>
> after running the script I would have
>
--- Guilherme Pinto <[EMAIL PROTECTED]> wrote:
> while ( and $_ =! /End of list/)
I think you mean !~
__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
--- "FIEDRICH,JAMIE (HP-USA,ex1)" <[EMAIL PROTECTED]> wrote:
> I have a text file in which I want to find a specific string - call
> it a heading. Once I've found the string (heading), I want to stuff
> the next line (content) into a variable.
>
> What is the most effective way to do this?
Mos
ot; ! " as you
state
above, but with just "!". Please be specific and precise.
Now:
> * myfile.pl *
> $filename ="costumer.txt";
> open(FILE,$filename ) or die ("can not open file : $filename");
> while ($line = ) {
>($id,$name
--- Kurt Edmiston <[EMAIL PROTECTED]> wrote:
> Here's a topic for discussion:
And a good one. =o)
> Coming from C++-land, I've always been taught over and over again
> that all subroutines/functions/blocks/etc should have only a single
> entry point and a single exit point. "It's just good pr
--- Jennifer Pan <[EMAIL PROTECTED]> wrote:
> Hello all, I came across this problem opening up files that are fed
> in from command line using "ls". I do not know why this script did
not
> work. Appreciated any input.
>
> #!/usr/local/bin/perl
>
> # I am trying to feed all the files in this d
--- Silvio Luis Leite Santana <[EMAIL PROTECTED]> wrote:
> Since double quotes need to be searched for variable interpolation,
> while single quotes don't, I should always (whenever possible) prefer
> single quotes instead of double quotes in my programs, because:
>
> print 'hi all';
>
> would
--- Ken <[EMAIL PROTECTED]> wrote:
> susbtr is almost identical to mid, but better (isn't that true for
> most of perl?)
> perldoc -f susbtr
lol -- I think so.
Compare "use strict" with "Option Explicit". =o)
Anyway
> - Original Message -
> From: "Sebadamus" <[EMAIL PROTECTED]>
> T
--- Jennifer Pan <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I stdin a file name: xxx.txt
> and I would like to have a output file name called x.txt.yyy
>
> This is how I do it
>
> $FILENAME = ;
> $output = "$FILENAME.y";
> print "$output";
I suspect the problem in the newline you get from
--- "Grossner, Tim X. (AIT)" <[EMAIL PROTECTED]> wrote:
> How would I do this:
>
> file A contains a line of characters always looking like "hostname
> X".
> I want to take the X and assign that to a scalar...I tried making
> an
> array out of it by using grep to search for the line sta
--- [EMAIL PROTECTED] wrote:
> Hi folks,
Hi. =o)
> I'm putting together simple script for doing dumps. I have the
> command running but I can't get the output to write to my log file.
> I keep getting errors and have tried several things and none of it
> works. Please help.
>
> Here is a sam
--- Eric Chun <[EMAIL PROTECTED]> wrote:
> What does
> $pid = open(CMD, "-|")
> mean? I assume this is forking a process, but I have not seen "-|"
> before.
> Has anybody come across this kind of perl command before?
It's a MAGIC fork. =o)
Check out perldoc -f open.
=
print "Just ano
--- Steve MacMullin <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'm new to using perl and am having a terrible time debugging things
> because
> of the (seemingly to me) quite unhelpful run-time errors. I do use:
> 'use
> strict;' and get an error like the following: 'Scalar found where
> ope
--- Eric Chun <[EMAIL PROTECTED]> wrote:
> I've just seen a strange thing. I made up a simple perl program:
> #!/usr/local/perl -w
> my ($summary_data);
> $summary_data->{'express'} = "blahblahblah\n";
> print $summary_data->{'express'};
> Notice that $summary_data is not
--- David Gilden <[EMAIL PROTECTED]> wrote:
> The following uppercase'S the whole string, when all I want is the
> first letter.
> sub uppercase{
> ($s) = @_; return uc($s); # works but caps the whole string
> }
Others have already said to use ucfirst. =o)
> lastly, in this hash of hashs..
>
--- Mike Patterson <[EMAIL PROTECTED]> wrote:
> How do I compare if a value it missing?
> I want to use a second date if the first date is missing.
>
> #Imagine my vars have this data
> $date1="";
> $date2="10/2/1997";
>
> if ($date1 eq "") {#do I use "", MISSING key word
>
) and ($s_port ne
"nameserver"))
{
blah
}
Produces the warning:
"Use of uninitialized value in string ne at logisys.pl line 139, line 3"
Even though the initialise line is there.
Any ideas?
Paul.
--
--- [EMAIL PROTECTED] wrote:
> > Rajanikanth Dandamudi <[EMAIL PROTECTED]> said:
>
> > Is there a concept of macros in perl, i.e.
> > Is there some thing like preprocessor processing
> > in perl. Thanks in advance.
>
> Nto that I am aware of. I have preprocessed perl scripts with the m4
>
In reply-to [EMAIL PROTECTED] on Tue Jul 17 16:24:55 2001
>On Jul 17, [EMAIL PROTECTED] said:
>
>> $reason2= @theline[$headers{"reason\:"}];
>> $s_port = @theline[$headers{"s_port"}];
>
>You should be warning about using @ when you should be using $.
>
>> if(($reason
--- Roland Schoenbaechler <[EMAIL PROTECTED]> wrote:
> In a sub of my script I redirected STDERR in a file. How can I
> redirect the STDERR back to the default (screen) for the following
> subs?
Use local(). It's not something to make a big habit of, but this is a
good place for it.
sub func {
--- Tyler Longren <[EMAIL PROTECTED]> wrote:
> That doesn't seem to work. I want if a variable doesn't equal
> anything, then do something. Here's a piece:
> if ($options{a} eq "" && $options{a} eq "") {
> print "
> Usage: log.pl [-d] -a -i [n]\n
> -d : specify device. If no
--- Chuck Morford <[EMAIL PROTECTED]> wrote:
> I think I read somewhere that when I store a Reference in an Array it
> gets converted to a String and can no longer be used as a
> Reference...Is that right?
opps -- I misread this in my initial answer.
Using a reference in a string context will co
--- Ruth Albocher <[EMAIL PROTECTED]> wrote:
> hi
> can you please tell me what is the difference between the two
> parameters
> in the call:
>
> create_unit(SDunit, 'SDunit_name'); (it is code i need to
> maintain...
> )
Well, SDunit there is a bit odd.
looks like a bareword -- does the scri
--- Frank Newland <[EMAIL PROTECTED]> wrote:
> I want to use perl to do what I can't do on large files with sed.
>
> 1. I run the following Unix command:
> $prompt> sed -f list_of_changes original > outputfile
>
> 2. Extract of list_of_changes:
>
> s/KAREN/LAURA /g
> s/KARA/MONA/g
> s/MIKE/O
--- EriK W <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have a question maybe about "sort" or regular expression,
>
> @new = sort {($b =~ /=(\d+)/)[0] <=> ($a =~ /=(\d+)/)[0]|| uc($a)
> cmp uc($b) } @old;
>
> I don't really understand this /=(\d+)/ [0] thing, expecially that
> "=" , what does
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Fri, Jul 20, 2001 at 09:01:55AM -0700, Paul wrote:
> > I don't know the behavior for certain on a final return of zero,
> > but I don't think it does anything, which likely means that later
> > things may or
--- EriK W <[EMAIL PROTECTED]> wrote:
> Thanks , Paul, but I think I can't make it straight part of because
> my broken English , so it seems make sense for me, but
Better to try than sit quietly and be confused. =o)
> > In
> >
> > ($b =~ /=(\d+)/)[0]
--- Bob Bondi <[EMAIL PROTECTED]> wrote:
> I've been trying to use
> opendir($tempdir,@ARGV[0]) or die "Couldn't open the directory,
$!";
...use $ARGV[0], not @ARGV[0]
^ ^
> Can't use string ("tempdir") as a symbol ref while "strict refs" in
> use at run test4.pl lin
--- EriK W <[EMAIL PROTECTED]> wrote:
> Thanks! Paul, you are really good tutor, It is much clear for me now,
Thank you. That's a high compliment.
> But I think I still can't easily distinguish the list and scalar
> context.
That's a common problem.
To overs
--- Maxim Berlin <[EMAIL PROTECTED]> wrote:
> Hello Greg,
>
> Sunday, July 22, 2001, Greg <[EMAIL PROTECTED]> wrote:
>
> G> I need to split an array up. I need to split on colons and spaces.
> I appear
> G> to be successful splitting on a colon, but am having difficulty
> doing both.
> G> Any
--- "Zysman, Roiy" <[EMAIL PROTECTED]> wrote:
> Hi Guys and Girls,
> Does anyone have an idea of an elegent way to
> extract certain item from an array (not the last one or the first
> one).
> The array should remain in a right order after the extraction.
> tanx.
If I understood you right,
@t
--- Michael Dube <[EMAIL PROTECTED]> wrote:
> So... if I have a string that contains tabs both at the beginning and
> in the middle, how do I just count the beginning ones?
> . . .
> $test = "\t\t\tsasdfasdftill:\tin\tscope?";
my($inittabs) = $test =~ /^(\t+)/;
print length($itittabs);
--- Craig S Monroe <[EMAIL PROTECTED]> wrote:
> I also need to capture all commands, output to a logfile also.
> I have not been able to do this with system();
Why do you need system() at all?
Your Perl script can change directories &c., and you can dup STDERR and
STDOUT to filehandles if you ne
--- Stephanie Stiavetti <[EMAIL PROTECTED]> wrote:
> I need to make sure that a field contains ONLY letters... and this is
> the
> regular expression I'm using:
>
> $name=~/^[a-zA-Z]+/
> what am I doing wrong?
This guarantees that it *starts* with letters. Add a $:
$name=~/^[a-zA-Z]+$/
Now i
--- bc <[EMAIL PROTECTED]> wrote:
> how, in perl/cgi, or, what is a popular way of connecting to, and
> displaying, a csv file's contents to a browser, in table form?
Er.
Okay, um
CSV as in Comma Seperated Values?
...start the page, print the table headers, make sure the file is open,
then
--- Giridhar nandikotkur <[EMAIL PROTECTED]> wrote:
> Some archival data is to be retrieved from a
> partly-perl based (rest HT??) website passing through
> a set of 5-6 screens clicking 3-4 options on each
> screen.
> after the selection is done a tar file is stored at an
> ftp site whose name
--- Sally <[EMAIL PROTECTED]> wrote:
> Can anyone give me a general idea what the error premature end of
> script headers means? Is it an incorrect filename, or that the file
> can't be found or something else?
Assuming you're talking about the CGI error, it probably means that
something in the
--- bc <[EMAIL PROTECTED]> wrote:
> i'm an old asp/vbscript dude, i do not know how to "...make sure the
> file is open" either? any real quick explanation you can give me to
> get the file open in perlScript/CGI? to match what you said below?
lol ok:
use strict; # option explicit, but bett
--- Paul <[EMAIL PROTECTED]> wrote:
Maybe instead of just
> use CGI;
you should say
use CGI;
use CGI::Carp 'fatalsToBrowser';
That'll help you debug. =o)
__
Do You Yahoo!?
Make international calls for as low a
--- Neema Salimi <[EMAIL PROTECTED]> wrote:
I know you've already solved this on your own, but just a small note:
> if ($_ =~ /CA\s*ARG\s*1\s*(-*\d+\.\d+)\s*(-*\d+\.\d+)\s*(-*\d+\.\d+)/
the $_ =~ is unnecessary.
The match operator defaults to matching $_,
so saying
/foo/
is exactly equiv
--- Silvio Luis Leite Santana <[EMAIL PROTECTED]> wrote:
> Thank you very much for your help
> about Perl.
>
> There's just something I didn't get yet.
> When I write
>
> *PI = 5;
>
> What am I really doing?
I think you meant
*PI = \5;
Which is assigning the glob PI a reference to a lite
--- Daniel Mester <[EMAIL PROTECTED]> wrote:
> Hi again,
> for example i have a file like :
> zxcv zxcv
> qwer asdf
> bnmm sdfgy
>
> I need to split the sentences into a variables in list.
> So i do it in 2 stages:
> 1. Remove the \t form each pair:
> foreach (@list) { push(@temp, (split(/\t
--- David Freeman <[EMAIL PROTECTED]> wrote:
> while(1){
> last until eof unless $email;
Okay, this is a seriously wierd constructm lol... =o)
First of all "last until" is a logical oxymoron. "last" breaks out of a
loop, "until" makes one. It's a statement that *could* only execute
once at
--- Mooney Christophe-CMOONEY1 <[EMAIL PROTECTED]> wrote:
> Does anyone know of a slick way to put an array into a hash?
>
> For example, given
>
> %a=
> (
> -a => 1,
> -b => 2,
> -c => 3
> );
> @b=qw/-x 24 -y 25 -z 26/;
>
> Is there a nice way to merge the hash implied by @b
--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 26, 2001 at 05:27:28PM -0700, Paul wrote:
> > sub pushHash (\%@) { # somebody please check that prototyping
>
> > local *INHASH = shift;
>
> This is clever, but should probably be avoided (mostl
--- Chris Rutledge <[EMAIL PROTECTED]> wrote:
> Hello all,
> Here's what I have..4 single dimension hashes that I'm trying to
> use to populate a single hash (single dimension)
>
> with...
>
> %data = return_hash( %one, %two, %three, %four );
Unless I misunderstand, you're wor
--- David Blevins <[EMAIL PROTECTED]> wrote:
> Here is a one-liner I just wrote to delete duplicate lines in a file.
>
> perl -ni.bak -e 'unless ($last eq $_){print $_};$last=$_;' theFile
That requires that it be sorted, doesn't it?
> Going with the TMTOWTDI credo, I was just curious if anyone
print OUTFILE;
> }
then PUT it in the hash, and print the record.
> else {
> }
> }
Otherwise, we've already printed it when we put it in the hash,
so do nothing.
Paul ;o]
__
Do You Yahoo!?
Make internat
--- Robb Wagoner <[EMAIL PROTECTED]> wrote:
> I have a two dimensional array where each element consists of a
> reference to an anonymous array.
>
> push(@array,[$var1,$var2,$var3]);
That's pretty much the way all multidimensional arrays (and hashes)
work in Perl.
> When I pass a referen
--- Jeff 'japhy/Marillion' Pinyan <[EMAIL PROTECTED]> wrote:
> perl -pe '$_ x= !$seen{$_}++' (attributed to some of Larry's genius)
LOL!!! Twistedly brilliant!
Ok, lemme see if I can parse this.
perl -pe says print each line after the -e code has been executed.
"$_ x= !$seen{$_}++" say
> >--- Jeff 'japhy/Marillion' Pinyan <[EMAIL PROTECTED]> wrote:
> >> perl -pe '$_ x= !$seen{$_}++'
> >>(attributed to some of Larry's genius)
> >
> >LOL!!! Twistedly brilliant!
> >
> >Ok, lemme see if I can parse this.
> [correct prognosis snipped]
> >Is that right?
>
> Yes. I attribut
--- Bob Bondi <[EMAIL PROTECTED]> wrote:
> I had wanted to keep all the declarations in a section and the subs
> in a section and the main script at the bottom, but, I find I must
add
> code in the declaration section!
I like to keep "sections" too, though the parser doesn't care so much.
Try th
--- David Blevins <[EMAIL PROTECTED]> wrote:
> > perl -nle 'print if !$seen{$_}++'
>
> The dash n (-n) puts the command 'print if !$seen{$_}++' in a while
> (<>) { ... } loop. So we get:
>
> while (<>) {
> print if !$seen{$_}++
> }
>
> $seen{$_}
>
> Tries to lookup the line in the hash
--- David Blevins <[EMAIL PROTECTED]> wrote:
> Truly astounding.
lol
> From: Paul [mailto:[EMAIL PROTECTED]]
> > --- David Blevins <[EMAIL PROTECTED]> wrote:
> > > > perl -nle 'print if !$seen{$_}++'
> > >
> > > $seen{$_}
--- Casey West <[EMAIL PROTECTED]> wrote:
> Yes, I imagine it would be a fun thing for beginners to see. Some
> might try hard to understand them. A teaser would be fine but, the
> entirety of a one-liner thread most likley doesn't belong on the
> beginners lists[*]. Not to mention, Fun With P
on just has to do a string catenation and one lookup;
the second has to do three lookups.
(And as always, if I fumbled something, please tell me. =o)
Paul
__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenge
301 - 400 of 1648 matches
Mail list logo