Re: How to split a large string with repeating delimiters into multiple substrings

2007-05-24 Thread Octavian Rasnita
Or if this string is stored in a file, and if it is very very big and you don't want to load it entirely into memory, you could use something like: {local $/ = ""; open(my $in, "11.txt"); while(<$in>) { chomp; print "$_\n"; } close $in; } It is simple to delete the first and last respectively ,

Re: Module question

2007-05-24 Thread Jeff Pang
David Moreno Garza 写道: Jeff Pang wrote: @EXPORT was used for exporting symbol (methods or variables) by default. When you say, use base 'Exporter'; our @EXPORT = qw/&mysub/; .. then mysub() would be exported into caller's name space defaultly. Would that also work using: our @EXPORT = qw/mysu

Re: Module question

2007-05-24 Thread David Moreno Garza
Jeff Pang wrote: > @EXPORT was used for exporting symbol (methods or variables) by default. > When you say, > use base 'Exporter'; > our @EXPORT = qw/&mysub/; > .. > then mysub() would be exported into caller's name space defaultly. Would that also work using: our @EXPORT = qw/mysub/; ? Or is

Re: How to split a large string with repeating delimiters into multiple substrings

2007-05-24 Thread David Moreno Garza
Michael Goopta wrote: > I am new to Perl. > > How can I split the below string and get the multiple > web-addresses in a list: (i.e. the strings between > and > > http://view-preprod.admission.net/abc/mactive/_NJMG_0002029003-01/i-1.JPG?t=tr/m:FitPad/w:199/h:124&t=ts/r:199x199http://view-prepro

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Rob Dixon
Jeff Pang wrote: Paul Johnson 写道: Jeff Pang wrote: Ben Edwards 写道: I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_publishers( $publisher, @files ) mnnn,don't pass an original array to a subroutine at a

Re: Upload a directory to remote FTP server

2007-05-24 Thread yaron
Hi, Did you try to use Net::FTP::Recursive (http://search.cpan.org/~jdlee/Net-FTP-Recursive-2.00/Recursive.pm) It seems to fit to your task. Yaron Kahanovitch - Original Message - From: "Shu Cho" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Thursday, May 24, 2007 10:26:00 AM (GMT+02

Re: Regarding pattern matching

2007-05-24 Thread Dr.Ruud
"Dharshana Eswaran" schreef: > $xyz =~ /\s*(\w+)\s+(\w+);/; > $b = $2; #variable name is stored here > > ... > > But the variables like pp_lac[COMMON_TYPE_MAX] and > pp_plmn_list[COMMON_TYPE_MAX] are not getting stored because of the > special character used inbetween the names. The

Regarding pattern matching

2007-05-24 Thread Dharshana Eswaran
Hi All, I am trying to extract strings from few files. The content of the file reads as shown typedef struct { REFID_T pp_ref_id; /* destination */ CAUSE_T pp_cause;/* Reason registered */ STATE_T pp_state; /* State for indicators */ COMMON_TY

Re: Regarding pattern matching

2007-05-24 Thread Jeff Pang
Dharshana Eswaran 写道: Hi All, I am trying to extract strings from few files. The content of the file reads as shown typedef struct { REFID_T pp_ref_id; /* destination */ CAUSE_T pp_cause;/* Reason registered */ STATE_T pp_state; /* State for i

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Jeff Pang
Paul Johnson 写道: On Thu, May 24, 2007 at 05:55:13PM +0800, Jeff Pang wrote: Ben Edwards 写道: I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_publishers( $publisher, @files ) mnnn,don't pass an original array

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Paul Johnson
On Thu, May 24, 2007 at 05:55:13PM +0800, Jeff Pang wrote: > Ben Edwards 写道: > >I am passing a reference to a hash ($publisher) and a array with an > >unknown number of elements (@files). So the call is > > > >delete_from_publishers( $publisher, @files ) > > > > mnnn,don't pass an original array

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Jeff Pang
Jeff Pang 写道: Ben Edwards 写道: I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_publishers( $publisher, @files ) mnnn,don't pass an original array to a subroutine at anytime. Instead just pass a reference to r

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Jeff Pang
Ben Edwards 写道: I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_publishers( $publisher, @files ) mnnn,don't pass an original array to a subroutine at anytime. Instead just pass a reference to routines.like,

Re: Passing multiple mixed arguments to subs

2007-05-24 Thread Srinivas
Hi Ben, You can use shift for this. sub remove_files_from_ftp_server { my $pub_detail = shift @_; my @files = @_; Thank You, -srini Ben Edwards wrote: I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_pu

Passing multiple mixed arguments to subs

2007-05-24 Thread Ben Edwards
I am passing a reference to a hash ($publisher) and a array with an unknown number of elements (@files). So the call is delete_from_publishers( $publisher, @files ) Currently the beginning of the sub is:- sub remove_files_from_ftp_server { my $pub_detail = $_[0]; my $args = @_; my @fi

Upload a directory to remote FTP server

2007-05-24 Thread Shu Cho
Hi list, I want to upload a directory to a remote FTP server, is there any nice solution? Here is my script: #!/usr/bin/perl use Net::FTP; use File::Find; $ftp = Net::FTP->new("host", Port => 1234); $ftp->login("usr", "passwd"); sub upload_file { $ftp->mkdir($File::Find::name, 1) if -d; $ft