Command line option for split

X

xlue897

Hi,

Can we specify the [limit] option for split in command line? For perl
code, we can do things like

@F=split /pattern/, expr, limit;

in command line, we can express pattern like
perl -F"/pattern/" -anle '...'

but how can we specify the limit in command line?


Thanks,

Steven
 
J

John W. Krahn

Can we specify the [limit] option for split in command line?
No.

For perl code, we can do things like

@F=split /pattern/, expr, limit;

That is what you are going to have to do.



John
 
X

xlue897

Can we specify the [limit] option for split in command line? For perl
code, we can do things like

No, I don't really think so.

Michele

If there are fields with trailing empty fields, Perl cannot get the
correct number of fields using command line options. So Perl is not
convenient and accurate in getting fields numbers with command line
options. And we should avoid using command line options to try to get
fields number.
 
M

Michele Dondi

If there are fields with trailing empty fields, Perl cannot get the
correct number of fields using command line options. So Perl is not
convenient and accurate in getting fields numbers with command line
options. And we should avoid using command line options to try to get
fields number.

It seems sensible and reasonable: after all command line options are
there for small tasks and not to solve all the problems that one may
face in Perl. In fact they would be better adopted for relatively
small scripts. In longer ones, adding a pair of lines for an explicit
loop or a split() makes things easier to follow and doesn't hurt much.


Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top