Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 4th, 2013, 05:51 PM
Jarwulf Jarwulf is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 14 Jarwulf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 49 m 34 sec
Reputation Power: 0
Perl file and split questions

Code:
my ($bumpFileVolume,$bumpFileDir,$name) = File::Spec->splitpath($bumpFile);
my @workDirArr = ($bumpFileVolume,$bumpFileDir);
my $workDir = File::Spec->catdir(@workDirArr);
chdir $workDir or die "$0 failed to chdir to working dir $workDir";

system ("sort -k 1,1 -k 4n -T $workDir $name >tempLoc_$name")==0 or die "$0 failed to sort $name";
open (BRK, "tempLoc_$name") or die "$0 failed to open file tempLoc_$name";
open (OUTTWO, ">loc_analyze_$name") or die "$0 failed to open file loc_analyze_$name";


I'm a little confused as to whats happening here. What does it mean to create the variable $name attach it to the file I assume is $bumpfile and then use in as the part of loc_analyze_$name or tempLoc_$name? Are they creating a new file or simply opening up an old one?


Also for


Code:
#LINE: while (@bumps){
LINE:    while (<FIL>) { 
	my $line2 = $_;
	chomp $line2;        
	my @parts = split;
	my $rom_ref = $parts[0];
	my $signal = $parts[1];



I'm assuming the array parts is from FIL being split. Is this correct?

Reply With Quote
  #2  
Old March 5th, 2013, 01:29 AM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 502 Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Days 18 h 51 m 13 sec
Reputation Power: 385
$name is the name of tghe file stripped of its path (directory) information.

The second code sniopopet is reading the file line by line and splitting each line inti an array (split on the soace character).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Perl file and split questions

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap