First off, check out 'perldoc -f split'. That will get you the man page.
This works for all built-in functions. But here goes:
split() is used to split up a string using a delimiter that you specify.
The basic syntax is this:
split(/patternToMatch/,$stringToSplit,$numberOfElements);
The
>Can someone explain to me what the purpose of split is? I am assuming you
>can take like a text file or something and separate it out?
>
>Thanks
>Mike
>
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
---
-
Can someone explain to me what the purpose of split is? I am assuming you
can take like a text file or something and separate it out?
Thanks
Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
> This is one of the reasons I gave up on "-w" a long time ago. You had
> to program around the $^%&@ "use of undefined value" warning constantly.
>
> Of course, Perl 5.6 introduced the "no warnings qw(uninitialized);"
> construct, which helps that problem, at the expense of some typing...
I o
On Fri, 2002-06-14 at 15:50, todd r wade wrote:
>
>
> Chas Owens wrote:
>
>
> >
> >> Alternately, you could say:
> >>
> >> $track ||= '';
> >>
> >> right before the next time you use foo after the split. I dont know
> why this
> >> works offhand, I just remember reading in the docs somewher
yes i suppose you are right, consider my tail between my legs.
At 15:03 14/06/2002 -0400, Jason Frisvold wrote:
>Perhaps your network engineer was thinking in relation to a Class C? In
>reality, you can have subnets where .3 is a broadcast... (/30) It's
>all relative to what subnet mask you ar
> -Original Message-
> From: todd r wade [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 14, 2002 3:51 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: "lazy" variable declaration
>
> ...
> Your examples are neither equivalent nor dangerous in the context of
> this threa
John,
Thanks for the optimized version. The outfile isn't used yet. I have it
sitting there because that is the next step.
Craig Hammer
Internal Infrastructure Team Lead
Parago, Inc.
972-538-3936
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTE
On Fri, 2002-06-14 at 07:15, Franck FASANO wrote:
> >
> > Objet: Re: How to open STDOUT ?
> > Date: Thu, 13 Jun 2002 21:34:16 -0700
> > De: "Todd Wade" <[EMAIL PROTECTED]>
> > A: [EMAIL PROTECTED]
> >
> > "Franck Fasano" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTE
On Fri, 2002-06-14 at 08:14, Angela Fisher wrote:
> Hi,
>
> I replaced qx{ ./test.pl -P @ARGV};
> with exec(" ./test.pl -P @ARGV");
>
> This works. I'm very new at this so excuse the
> question. Can "qx{}" be used to execute a command
> or script? It just looks like a way to quote a string
>
Chas Owens wrote:
>
>> Alternately, you could say:
>>
>> $track ||= '';
>>
>> right before the next time you use foo after the split. I dont know
why this
>> works offhand, I just remember reading in the docs somewhere that
its exempt
>> from warnings. But for me, that is crossing over int
Hi,
I have a script that opens a file and needs to grab certain values from it.
Can anyone recommend a good file tokenizing module? Thanks.
-Jose
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
check out length();
perldoc -f length
> -Original Message-
> From: Batchelor, Scott [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 14, 2002 3:26 PM
> To: '[EMAIL PROTECTED]'
> Subject: String Length?
>
>
> Is there an easy way to compare the length of a string to a value?
>
> Such as
Is there an easy way to compare the length of a string to a value?
Such as:
If $var < 8 {
Do something
}
Thanks in advance.
Scott
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Perhaps your network engineer was thinking in relation to a Class C? In
reality, you can have subnets where .3 is a broadcast... (/30) It's
all relative to what subnet mask you are using for that particular IP
address.
---
Jason H. Frisvold
Senior ATM Engineer
Engineeri
Craig Hammer wrote:
>
> Take a look at this script. I created it to read my firewall log files, and
> then give me a sort and count per unique address. You could substitute a
> more traditional grep in place of the substitution I use.
>
>
> opendir(DIR, "/clog1") || die("Unable to open logdir
ok, maybe that is ok but I recently was told by a networking engineer that
the last octet _shouldn't_ be 255. the first 3 can be i think.
At 14:34 14/06/2002 -0400, Tim Musson wrote:
>Hey Mat,
>
>My MUA believes you used NeoMail 1.25
>to write the following on Friday, June 14, 2002 at 9:04:54 AM
On Friday, June 14, 2002, at 11:34 , Tim Musson wrote:
> Hey Mat,
>
> My MUA believes you used NeoMail 1.25
> to write the following on Friday, June 14, 2002 at 9:04:54 AM.
>
> MH> actually, it should only be 1-254 inclusive as 255 is reserved for
> MH> broadcast or other special addresses (some
Hi: Well, here's a success:
#! /usr/local/bin/perl -w
# Simple program to prepare an email message for entry into a database
# This program simply discards header information, and prints message
# body. It assumes a specific number of lines for $header, which in my case
# is 5. The range operato
Hey Mat,
My MUA believes you used NeoMail 1.25
to write the following on Friday, June 14, 2002 at 9:04:54 AM.
MH> actually, it should only be 1-254 inclusive as 255 is reserved for
MH> broadcast or other special addresses (sometimes not used atall).
MH> oficially the 255 node it ignored.
I don'
> Alternately, you could say:
>
> $track ||= '';
>
> right before the next time you use foo after the split. I dont know why this
> works offhand, I just remember reading in the docs somewhere that its exempt
> from warnings. But for me, that is crossing over into the land of ugly =0).
$track
On Fri, 2002-06-14 at 08:20, Mat Harrison wrote:
> why are you typing
>
> print STDOUT "text here\n";
>
> try just typing
>
> print "text here\n";
>
> because STDOUT is the default destination for text when you run it from
> the command line.
This is sort of true. STDOUT is the f
Im working on an example from a book and incorperating perl script to a
scroll type program this is what I have for perl:
#!/usr/bin/perl
print "Content-type: application/x-javascript\n\n";
print "var result = new Array(";
use LWP::Simple;
$URL = get 'http://www.perl.org';
print $URL;
print
Thank You
Thank You
Thank You
I LOVE THIS MAILING LIST!!!
Ernest P. Tucker II
Network Technician
"The organization that can't communicate can't change, and the corporation
that can't change is dead."
--Nido Qubein
-Original Message-
From: Bob Showalter [mailto:[EMAIL
> -Original Message-
> From: Tucker, Ernie [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 14, 2002 10:39 AM
> To: [EMAIL PROTECTED]
> Subject: parsing a variable
>
>
> I have a global variable name @offline. It has the following
> information
> stored in the variable. What I need to do
oops forgot the code. Here it is.
foreach $offline (@offline)
{
$mac = $offline =~ m/.* (\.\.) .*/;
push (@macs,$mac);
}
-Original Message-
From: Tucker, Ernie [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 14, 2002 12:07 PM
To: 'Janek Schleicher'; [EMAIL PROTECTED]
S
Would something like this work? I tried it but it returned all 1. Any ideas
Ernest P. Tucker II
Network Technician
"The organization that can't communicate can't change, and the corporation
that can't change is dead."
--Nido Qubein
-Original Message-
From: Janek Schleicher [mail
Robert Hanson wrote at Fri, 14 Jun 2002 17:49:03 +0200:
> How about this?
>
> # untested
> my @mac = map {/((?:[a-fA-F0-9]{4}\.){2}[a-fA-F0-9]{4})/ and $1} ( @offline );
>
> Rob
>
or perhaps a little bit more readable:
my $hexdigit = qr/[a-fA-F0-9]/;
my $hexword = qr/$hexdigit{4}/;
my $mac
On Friday, June 14, 2002, at 07:38 , Batchelor, Scott wrote:
> In Perl:
>
> $var = @ARGV;
>
> print "$var";
>
> By just printing the $var to STDOUT in perl should give me the $returnvar.
print the @ARGV would have shown you all that was passed.
Think about the symantical problem here - you ju
How about this?
# untested
my @mac = map {/((?:[a-fA-F0-9]{4}\.){2}[a-fA-F0-9]{4})/ and $1} ( @offline
);
Rob
-Original Message-
From: Tucker, Ernie [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 14, 2002 11:37 AM
To: Hanson, Robert; Tucker, Ernie; [EMAIL PROTECTED]
Subject: RE: parsing
thanks
is there any other ways to do this. What I would like to do is something
like the following. I would like to grep out the second column which is the
mac id and store it into a variable called @mac. Any help would be great. I
am have brain drain.
Ernest P. Tucker II
Network Technician
On Friday, June 14, 2002, at 06:04 , Mat Harrison wrote:
[..]
> actually, it should only be 1-254 inclusive as 255 is reserved for
> broadcast or other special addresses (sometimes not used atall).
> oficially the 255 node it ignored.
that is actually a "dangerous" assertion to make. Since it ba
On Jun 13, John W. Krahn said:
>> if ($invnummer ne "") {
>
>What if $invnumber has the value undef?
If $invnummer [sic] is undef, then in a string context, $invnummer DOES eq
"", so he's safe.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #
Here is one solution...
For each item in @offline the MAC will be captured in the variable $1.
# untested...
for ( @offline ) {
if ( /((?:[a-fA-F0-9]{4}\.){2}[a-fA-F0-9]{4})/ ) {
print "MAC: $1\n";
}
else {
print "No MAC here\n";
}
}
Rob
-Original Message-
From: Tucker
Thanks for your reponse.
exec() can be replaced with system() to get the
return value too!
Angela
Franck FASANO wrote:
>
> Thank you for the answer Angela!
> That's a solution.
>
> but exec is different of qx (it doesn't return anything except false
> if the command is not found ) and I nee
I have a global variable name @offline. It has the following information
stored in the variable. What I need to do is parse or split the variable and
store the mac id in a variable . What is the proper way to do this?
Cable3/0/U0 0020.4098.43fc 944 onlineJun 13 14:09:56 0.00 32.56 5
Cab
Ok, I am still having some problems with this...
Here is basically what I am doing...
In PHP:
Exec ("path/perlscript.pl", $var1, $returnvar)
Now this calls the perl script from PHP passing the perl script $var1 The
perl script then should run and give me $returnvar.
In Perl:
$var = @ARGV;
> Does anyone have experience of using Perl to control any
> Novell products such as Netware, eDirectory (NDS) etc.
>
> I don't have a specific requirement at present but we do a
> lot of Novell stuff and I am interested to know what can
> be/has been done.
>
> Apologies if this question is a
Thank you for the answer Angela!
That's a solution.
but exec is different of qx (it doesn't return anything except false
if the command is not found ) and I need the return value because
my script is more huge than test.pl in fact.
Several scripts call others .
An other is to replace qx by prin
> I'm using the following command to output the results to screen and a
> output file:
>
> open(F,"tee $2 @ARGV[0].txt >CON:");
>
> This works great but the output file created .txt
> has a "box"
> ascii character. Looks like a carraige return also.
> How can I remove this?
This sounds like
actually, it should only be 1-254 inclusive as 255 is reserved for
broadcast or other special addresses (sometimes not used atall).
oficially the 255 node it ignored.
> ,
>
> I seem to recall a discussion on a RegEx to match an IP address, but
> can't seem to find it. Anyone have any idea
why are you typing
print STDOUT "text here\n";
try just typing
print "text here\n";
because STDOUT is the default destination for text when you run it from
the command line.
>
> >
> > Objet: Re: How to open STDOUT ?
> > Date: Thu, 13 Jun 2002 21:34:16 -0700
> > De: "Todd Wade" <[
You could either roll your own or use Regexp::Common.
http://www.cpan.org/modules/by-module/Regexp/Regexp-Common-0.01.readme
It might look like this...
(?:[1]?\d{1,2}|2[0-4]\d|25[0-5]\.){3}[1]?\d{1,2}|2[0-4]\d|25[0-5]
Or something like that.
Rob
-Original Message-
From: Tim Muss
Langa,
Take a look at this script. I created it to read my firewall log files, and
then give me a sort and count per unique address. You could substitute a
more traditional grep in place of the substitution I use.
<>
Craig Hammer
Internal Infrastructure Team Lead
Parago, Inc.
972-538-3936
,
I seem to recall a discussion on a RegEx to match an IP address, but
can't seem to find it. Anyone have any ideas, or recall what it
would be? Or could toss it together?
First Octet is 1-255 inclusive,
Second Octet is 0-255 inclusive,
Third Octet is 0-255 inclusive,
Fourth Octe
Hi,
I replaced qx{ ./test.pl -P @ARGV};
with exec(" ./test.pl -P @ARGV");
This works. I'm very new at this so excuse the
question. Can "qx{}" be used to execute a command
or script? It just looks like a way to quote a string
to me.
Angela
Franck FASANO wrote:
>
> >
> > Objet: Re: How to o
>
> Objet: Re: How to open STDOUT ?
> Date: Thu, 13 Jun 2002 21:34:16 -0700
> De: "Todd Wade" <[EMAIL PROTECTED]>
> A: [EMAIL PROTECTED]
>
> "Franck Fasano" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > I have recuperated a module from the web
This sounds fairly interesting...
http://developer.novell.com/ndk/perl5.htm
There's some docs at the bottom of that page about doing
stuff with Novell things using perl.
Can't say I've ever used it myself, and haven't touched a
netware box for years, but it looks like good stuff.
hth,
Daniel
On Thu, Jun 13, 2002 at 11:27:05PM -0700, tom poe wrote:
> #! /usr/local/bin/perl -w
> open (IN, "<$file") or die "Can't open $file: !$\n";
> while () {
> # Skip lines unless we have a blank line
> next unless /^\s*?/;
Nope. The comment doesn't match your code. The code says
"cont
Did U chk the directory u r in
try doing this
`cd $DIRECTORY; cp src dest `;
Ronnie Livingston wrote:
> Hi, I have a textfile with a list of gifs (ex. planet.gif, star.gif)and I
> have a perl program which grabs one of the filenames randomly. What I
> want to do is use the filename and copy it
Thats simple.
change the regexp
$filestr=~s/$SEARCH.*?$SEARCH/$SEARCH $HTML $SEARCH /;
On Fri, 2002-06-14 at 09:36, Troy May wrote:
> Thank you, that worked! :)
>
> By the way, I'm thinking of a new thing that I want to do. How would I
> alter this to open another page the same way, but re
doh, that did it. thanks felix.
-Ronnie
On 14 Jun 2002, Felix Geerinckx wrote:
> on Fri, 14 Jun 2002 06:43:53 GMT, [EMAIL PROTECTED] (Ronnie
> Livingston) wrote:
>
> > Hi, I have a textfile with a list of gifs (ex. planet.gif,
> > star.gif)and I have a perl program which grabs one of the
> > fi
Michael Pratt wrote at Fri, 14 Jun 2002 00:14:41 +0200:
> Well that doesnt give me what I want. I want to search a text file for a Key word
>then display
> the contents to a second keyword.
>
> For example take the above paragraph and display just ' want to search a text file
>for a Key word
on Fri, 14 Jun 2002 05:42:04 GMT, [EMAIL PROTECTED] (Langa
Kentane) wrote:
> Greetz,
> I need some help with IP address matching. For instance I have a
> log with an IP address 10.3.2.1 and 10.3.4.5. I want to match all
> IP addresses in the 10.3.0.0 mask 255.255.0.0 range. How would I
> do this
on Fri, 14 Jun 2002 06:43:53 GMT, [EMAIL PROTECTED] (Ronnie
Livingston) wrote:
> Hi, I have a textfile with a list of gifs (ex. planet.gif,
> star.gif)and I have a perl program which grabs one of the
> filenames randomly. What I want to do is use the filename and
> copy it to random.gif but I k
55 matches
Mail list logo