Perl basic code 3


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl basic code 3
# 1  
Old 08-24-2011
Perl basic code 3

Hi ,

I am having csv contains data
Code:
2011-08-23 11:11:00.074+0000: Info: Duplicate Order is not processed,Original Order Tuple
 ($category, $type) = split(',', $_ , 2);

what is the split function work here??

Thanks

Moderator's Comments:
Mod Comment Please start using code tags, thanks.

Last edited by zaxxon; 08-24-2011 at 07:45 AM.. Reason: code tags
# 2  
Old 08-24-2011
$_ contains the current line ( if you are reading the file line by line using while loop )
# 3  
Old 08-24-2011
Thanks itkamraj

can u plz explain the whole command of split

what is the use of , and 2 in split and how it relate with catagory and type
# 4  
Old 08-24-2011
Did you know that Perl has a very handy help system which you can access, for example, by typing perldoc -f split at the command line? Also, perldoc.perl.org has the same information in HTML.
# 5  
Old 08-25-2011
I have seen lots of code, but i am unable to understand the posted code
# 6  
Old 08-25-2011
just read out this example

Perl split function reference - learn how to use Perl's split() function in this quick tutorial.

and let us know, if u still dont understand
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Basic Question on perl use POSIX [SOLVED]

Hi guys, I think this is a basic question. I'm not very familiar with this. I'm trying to round a number up and round a number down. From what I have read this can be done using POSIX. I have tried to to use this, but i'm getting errors: sub findGridBounds($$$%) { use POSIX; ... (0 Replies)
Discussion started by: WongSifu
0 Replies

2. Shell Programming and Scripting

perl basic code

Hi, foreach $cat (sort{$cats{$b} <=> $cats{$a}} keys %cats) can anyone explain me above code?? i am new to perl Thanks (1 Reply)
Discussion started by: pspriyanka
1 Replies

3. Shell Programming and Scripting

perl basic code

Hi, can anybody explain me below code $cats{$category}++ Thanks (2 Replies)
Discussion started by: pspriyanka
2 Replies

4. Programming

Basic perl code- Date format

Hi friends, Please see the below code carefully. ======================================================= # Get batch date and Ord range open OR,$ARGV; while (<OR>) { # find the batch date next if length $_ < 3; # BLANK LINE # last if $. > 120; # sample should be good enough... (2 Replies)
Discussion started by: pspriyanka
2 Replies

5. Shell Programming and Scripting

Basic Perl - pass by ref

#!/usr/bin/perl sub addToHash{ my(%hash) = @_; $hash{ 'A' } = 'value'; $hash{ 'B' } = 'value'; $hash{ 'C' } = 'value'; print("Hashmap size is " .keys(%hash) . "\n"); } my %myhash = (); addToHash(\%myhash); print("Hashmap size is " .keys(%myhash) . "\n"); I want this... (6 Replies)
Discussion started by: chrisjones
6 Replies

6. Programming

Basic perl code

hi, can anybody explain me the below code. i am new to perl ========================================== $o_dups{$1} = 1 if /^\w+\t.{19}\t(+),/; ========================================== regards, priyanka (2 Replies)
Discussion started by: pspriyanka
2 Replies

7. Shell Programming and Scripting

perl basic multiple pattern matching

Hi everyone, and thank you for your help with this. I am VERY new with perl so all of your help is appreciated. I have tried google but as I don't know the proper terms to search for and could be daunting for a newbie scripter... I know this is very easy for most of you! Thanks! I have a... (4 Replies)
Discussion started by: sinusoid
4 Replies

8. Programming

Problems using Perl DBI to edit database entries - basic stuff

Hello. I am taking a Perl class in college and we've briefly covered SQL and moved on. We have a term project and we can do whatever we want. My project will rely strongly on an SQL Database so I am trying to learn as much about Perl DBI as I can to get things up and going. I am basically... (1 Reply)
Discussion started by: Dave247
1 Replies

9. UNIX for Dummies Questions & Answers

basic perl question

Hi, I was jus goin through a ebook on perl....it says u get binary installation for both unix and windows.....doesnt perl come already bundeled with unix ?cause i never installed any perl from binary........but i am able to execute perl programs...... Thanks and Regards Vivek.S (1 Reply)
Discussion started by: vivekshankar
1 Replies
Login or Register to Ask a Question