Re: array question

2006-05-10 Thread M. Kristall
for (my $i = 0; $i < @arry; $i++) { splice (@arry, $i, 1, split (' ', $arry[$i], 2)); } If one of the elements of @arry contains "one two three" then using "2" will add the two elements "one" and "two three" instead of the three elements "one", "two" and "three" so you may still be left with

Re: using Perl grep to populate a scalar

2006-05-10 Thread Tom Phoenix
On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: my (@key2,$value2) = 0; This statement is odd. It's making a new array with a single element (which element is zero). I think you mean something like this: my(@key2); my $value2 = 0; $key2[$value2++] = (grep /mirror/gi, `lvdis

RE: using Perl grep to populate a scalar

2006-05-10 Thread Smith, Derek
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: Wednesday, May 10, 2006 6:35 PM To: Smith, Derek Cc: Perl Beginners Subject: Re: using Perl grep to populate a scalar On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: > if (/(?)vg00/) {

Re: using Perl grep to populate a scalar

2006-05-10 Thread Tom Phoenix
On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: if (/(?)vg00/) { That doesn't look right. Why is that question mark inside parentheses? If Perl doesn't complain about that pattern, maybe it should. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL

Re: pointer to subroutine?

2006-05-10 Thread Bryan R Harris
> : Okay, I'll rename it to something else -- but I still want > : it to be called "_uc" in my code and maybe just "u" > : available to the user. Is this possible? > > Yes. You can have another sub call _uc(). > > sub u { > return _uc(@_); > } > > > Subroutines are in the Symbol

RE: pointer to subroutine?

2006-05-10 Thread Charles K. Clarkson
Bryan R Harris wrote: : Okay, I'll rename it to something else -- but I still want : it to be called "_uc" in my code and maybe just "u" : available to the user. Is this possible? Yes. You can have another sub call _uc(). sub u { return _uc(@_); } Subroutines are in the Symbol Ta

RE: using Perl grep to populate a scalar

2006-05-10 Thread Smith, Derek
-Original Message- From: Smith, Derek Sent: Tuesday, May 09, 2006 5:22 PM To: Perl Beginners Subject: using Perl grep to populate a scalar All, I am trying to populate a scalar (ideally a hash) using a Perl grep but it is not working. I even tried to use an array and no data was pu

Re: Removing duplicate IDs

2006-05-10 Thread John W. Krahn
macromedia wrote: > Hi, Hello, > I added your changes to my script but now I get no output. See code below: > > Syntax: perl test.pl in.srt out.srt > > > #!/usr/local/bin/perl > > require 5.000; > > my %tags = (); > my %seen; > > my $input = $ARGV[0]; > my $output = $ARGV[1]; > > open (FIL

Re: Tie::File adds extra lines if recsep is "\n\n"

2006-05-10 Thread Ankur Gupta
On 5/10/06, D. Bolliger <[EMAIL PROTECTED]> wrote: Ankur Gupta am Mittwoch, 10. Mai 2006 11.23: > Hi, > > Using Tie::File with recsep = "\n\n" adds two extra lines to the > original file when I iterate through the entire file. If I just change > one record then its fine. > > Below is the program

Re: pointer to subroutine?

2006-05-10 Thread Bryan R Harris
>> I have a little perl calculator tool that folks in our group use for >> various >> things... One of the routines it has is a unit converter, _uc. I'd > like >> to >> make that available to the user as "uc". Can I make "uc" work just > like >> "_uc"? > > uc() is a Perl built-in function to

RE: Omitting duplicate IDs in output file

2006-05-10 Thread FlashMX
I need some help. I can't figure out how to omit duplicate IDs in the output file. #!/usr/local/bin/perl require 5.000; my %tags = (); my $input = $ARGV[0]; my $output = $ARGV[1]; open (FILE, "< $input") or die "cannot open $input: $!\n"; open (OUTPUTFILE, "> $output") or die "cannot open

RE: Trapping errors

2006-05-10 Thread Timothy Johnson
Do something like this: ### Win32::OLE->Option(Warn => \&Error_Handler); sub Error_Handler{ print "WARN!!! ".Win32::OLE->LastError."\n"; } ## -Original Message- From: Gallagher, Tim (NE) [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 10, 2006 11:20 AM To: Perl Beg

Trapping errors

2006-05-10 Thread Gallagher, Tim \(NE\)
I am using wmi within Perl and if I get any errors the script will die I don't want to script to die, I want the script to continue. Here is part of my script and if any of these lines has a problem the script dies. How can I trap the errors and keep the script going? Thanks -T sub GetBIOS {

Re: array question

2006-05-10 Thread John W. Krahn
M. Kristall wrote: > John W. Krahn wrote: >>> for (my $i = 0; $i < @arry; $i++) { >>> splice (@arry, $i, 1, split (' ', $arry[$i], 1)); >>> } >> >> How does that populate the @new_array variable? > > Mine doesn't populate @new_array. It takes the original array and > replaces it with the equiv

RE: pointer to subroutine?

2006-05-10 Thread Ryan Frantz
> -Original Message- > From: Bryan R Harris [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 10, 2006 12:37 PM > To: Beginners Perl > Subject: pointer to subroutine? > > > > I have a little perl calculator tool that folks in our group use for > various > things... One of the routines

pointer to subroutine?

2006-05-10 Thread Bryan R Harris
I have a little perl calculator tool that folks in our group use for various things... One of the routines it has is a unit converter, _uc. I'd like to make that available to the user as "uc". Can I make "uc" work just like "_uc"? Thanks! - B -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: How to get the file's end-lines?

2006-05-10 Thread JupiterHost.Net
Tom Phoenix wrote: On 5/10/06, Practical Perl <[EMAIL PROTECTED]> wrote: I want to know,is there a pure perl way to do that without using the 'tail' unix command? Yes. http://search.cpan.org/perldoc?File::Tail::App Have you tried to implement it? How far have you gotten? -- To unsub

Re: How to get the file's end-lines?

2006-05-10 Thread Tom Phoenix
On 5/10/06, Practical Perl <[EMAIL PROTECTED]> wrote: I want to know,is there a pure perl way to do that without using the 'tail' unix command? Yes. Have you tried to implement it? How far have you gotten? Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PRO

How to get the file's end-lines?

2006-05-10 Thread Practical Perl
Hello,here, I want to get some numbers of end-lines from a file,under unix shell,I can do: $ tail -2000 file.txt or I can do it in perl script: my $lines = `tail -2000 file.txt`; I want to know,is there a pure perl way to do that without using the 'tail' unix command?

Re: array question

2006-05-10 Thread Dr.Ruud
"Timothy Johnson" schreef: > if I had my way, I'd remove > [...] the default variable $_. But why would you want that? #!/usr/bin/perl use strict; use warnings; sub say { print +(@_ ? @_ : $_), $/ ; 1 } say for 'A' .. 'Z' ; for ( 'a' .. 'z' ) { say } ; for my $c ( 'A' .. 'Z' ) { say $c

Re: Perl 5.8

2006-05-10 Thread Bjørge Solli
On Wednesday 10 May 2006 11:28, Nilay Puri, Noida wrote: > I installed perl 5.8 on Solaris server using > SiePerl-5.8.0-bin-1.0-IRIX6.5.INSTALL.IP22.tar available for Solaris. ^ > Only untarring was required. No "make" steps. This seems to be a precompiled

Perl 5.8

2006-05-10 Thread Nilay Puri, Noida
Hi All, I installed perl 5.8 on Solaris server using SiePerl-5.8.0-bin-1.0-IRIX6.5.INSTALL.IP22.tar available for Solaris. Only untarring was required. No "make" steps. Afterwards when I tried using it, it gave error saying /usr/local/bin/perl can't execute binary file. What could be t

Re: Tie::File adds extra lines if recsep is "\n\n"

2006-05-10 Thread D. Bolliger
Ankur Gupta am Mittwoch, 10. Mai 2006 11.23: > Hi, > > Using Tie::File with recsep = "\n\n" adds two extra lines to the > original file when I iterate through the entire file. If I just change > one record then its fine. > > Below is the program > > use strict; > use warnings; > > use Tie::File; >

Re: array question

2006-05-10 Thread M. Kristall
John W. Krahn wrote: for (my $i = 0; $i < @arry; $i++) { splice (@arry, $i, 1, split (' ', $arry[$i], 1)); } How does that populate the @new_array variable? Mine doesn't populate @new_array. It takes the original array and replaces it with the equivalent of everyone else's @new_array :-)

Tie::File adds extra lines if recsep is "\n\n"

2006-05-10 Thread Ankur Gupta
Hi, Using Tie::File with recsep = "\n\n" adds two extra lines to the original file when I iterate through the entire file. If I just change one record then its fine. Below is the program use strict; use warnings; use Tie::File; my @array; tie @array, 'Tie::File', 'file', recsep => "\n\n" or d

print file

2006-05-10 Thread Rustam Hamidullin
$txt = `type file.txt`; ... -- Приятной работы... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

print file

2006-05-10 Thread Rustam Hamidullin
open FILE, "){ ... } -- Приятной работы... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]