Shift Question

2005-09-27 Thread Mulander
If I understood you question properly you want to know why people use shift in subrutines and how does shift work. I will try to make it short: shift works on lists, it removes the first element of the list ( the 0 indexed element ) and returns it as a lvalue ( if there are no more elements in a l

finding an lement in an array

2005-10-07 Thread Mulander
2005/10/8, Jabir Ahmed <[EMAIL PROTECTED]>: > Hello everyone, > > I have a pretty simple problem > > example : > > @a=qw( 1 2 3 4 5 6 7 ); > $b=5; > > now i just want to check if the value of $b i.e 5 > exists in the array @a or not > > Q 1) is there any way other than looping through the > array?

Destroying an object

2005-10-18 Thread Mulander
--cut-- > sub destroy_self { > >my $self = shift; >$self = undef; > > } --cut-- The destroy method must be named DESTROY ( case-sensitive ) So you would have to do: sub DESTROY { my $self = shift; undef $self; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Is this script safe?

2005-10-27 Thread Mulander
Why can't you use perl's built in rename(); function ? I think it would be safer. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Moving Folder Access denied

2005-12-03 Thread Mulander
one adjust your regex in split: split /\s+/,$your_line; Hope it helps, Mulander -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: file changes monitor

2005-12-13 Thread Mulander
append them to my file f) close connection Hope you understand what I have in mind, I think that if you move with seek forward exactly the number of bytes your file has, you will be at the beginning of the lines that you want to get. I didn't test it, and I'm not quite sure. Have Fun

Re: file changes monitor

2005-12-13 Thread Mulander
Hi again, I did some testing on the method I meantioned before here is the code: #!/usr/bin/perl use warnings; use strict; my $a = 'a.txt'; my $b = 'b.txt'; if(-s $a != -s $b){ print "Files differ\n"; open F1,">>$a" or die "Can't open: $!"; open F2,"<$b" or die "Can't open: $!"; seek F2,-s $a

Re: Inserting line at a specific point

2005-12-16 Thread Mulander
2005/12/16, MARG <[EMAIL PROTECTED]>: > Hi, > > I want to insert these two lines in Apache's httpd.conf: > LoadModule python_module modules/mod_python.so > AddModule mod_python.c > > just right after the line > LoadModule php5_module modules/libphp5.so > > and not at the end of the file (with a sim