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 December 15th, 2012, 12:25 PM
alpha_omega alpha_omega is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 11 alpha_omega User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 18 sec
Reputation Power: 0
Cant pipe output in perl or shell

my program works find if i use STDOUT, but if i use any form of piping either in perl with the open, '>', 'random****.txt' or if i use the shell command perl myfile > some****.txt the file shows 615mib but when you open it its blank.

i havent included the code 1 because im lazy and 2 because its fully functional theres just some weird piping issue. is over 2 million lines of print too much for perl to handle?

p.s. if the code is needed ill grab it from the other pc, but i dont use strict or warnings and shiz and hoped to alleviate the flames for it(p.s. no, that is not the problem the code works just wont pipe).

any1 have any ideas?

Reply With Quote
  #2  
Old December 15th, 2012, 12:42 PM
alpha_omega alpha_omega is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 11 alpha_omega User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 18 sec
Reputation Power: 0
heres the code

i use ver 5.014 i kno i should use strict and warning and that theres mtowtdi but please be kind

Code:
#!/usr/bin/perl

	@final_countdown = 1..53;

	foreach $fc ( sort @final_countdown ) {
		if ( $fc =~ /\d\d/ ) {
#			print "$fc\n";
			$final_countdown{"$fc"} = 1;
		} else {
#			print "0$fc\n";
			$final_countdown{"0$fc"} = 1;
		}
#		print "$fc\n";
	}

	foreach $fc1 ( sort keys %final_countdown ) {
#		print "$fc1\n";
		foreach $fc2 ( sort keys %final_countdown ) {
			if ( "$fc1" ne "$fc2" ) {
			if ( "$fc2"  > "$fc1" ) {
#				print "$fc1 - $fc2\n";
				foreach $fc3 ( sort keys %final_countdown ) {
					if ( "$fc2" ne "$fc3" ) {
					if ( "$fc1" ne "$fc3" ) {
					if ( "$fc3"  > "$fc2" ) {
#						print "$fc1 - $fc2 - $fc3\n";
						foreach $fc4 ( sort keys %final_countdown ) {
							if ( "$fc3" ne "$fc4" ) {
							if ( "$fc2" ne "$fc4" ) {
							if ( "$fc1" ne "$fc4" ) {
							if ( "$fc4"  > "$fc3" ) {
#								print "$fc1 - $fc2 - $fc3 - $fc4\n";
								foreach $fc5 ( sort keys %final_countdown ) {
									if ( "$fc4" ne "$fc5" ) {
									if ( "$fc3" ne "$fc5" ) {
									if ( "$fc2" ne "$fc5" ) {
									if ( "$fc1" ne "$fc5" ) {
									if ( "$fc5"  > "$fc4" ) {
#										print "$fc1 - $fc2 - $fc3 - $fc4 - $fc5\n";
										foreach $fc6 ( sort keys %final_countdown ) {
											if ( "$fc5" ne "$fc6" ) {
											if ( "$fc4" ne "$fc6" ) {
											if ( "$fc3" ne "$fc6" ) {
											if ( "$fc2" ne "$fc6" ) {
											if ( "$fc1" ne "$fc6" ) {
											if ( "$fc6"  > "$fc5" ) {
												print "$fc1 - $fc2 - $fc3 - $fc4 - $fc5 - $fc6\n";
											}
											}
											}
											}
											}
											}
										}
									}
									}
									}
									}
									}
								}
							}
							}
							}
							}
						}
					}
					}
					}
				}
			}
			}
		}
	}


EDIT: I removed the ( open FINAL, '>', 'countdown.txt' ) from the top and changed the print from print FINAL "..." to print to debug if i could use perl myprogram > coutdown.txt - needless to say this did not work

Reply With Quote
  #3  
Old December 15th, 2012, 02:00 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 737 OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 23 m 50 sec
Reputation Power: 928
How are you opening the file to check it? My guess is that you're using a text editor that chokes when given a multi-million-line file. Basic commands like "head countdown.txt" and "wc countdown.txt" should let you see if the file looks right without trying to pull the whole thing into memory at once.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
  #4  
Old December 15th, 2012, 02:10 PM
alpha_omega alpha_omega is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 11 alpha_omega User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 18 sec
Reputation Power: 0
using backtracks standard text editor and have tried kwrite. looking into your suggestions now, will comment back after i become familiar with their useage

Reply With Quote
  #5  
Old December 15th, 2012, 02:26 PM
alpha_omega alpha_omega is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 11 alpha_omega User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 1 m 18 sec
Reputation Power: 0
yes

ohh yea that was it, ty. thought i was going crazy for the past 10 hours. any suggestion on either a text editor where i can view the entries or a way to load it into a separate perl program without overloading my ram?

suppose i could edit the output of that file that gets altered and then placed in a separate file for opening and viewing line by line...but would be a lot less manageable...

Reply With Quote
  #6  
Old December 15th, 2012, 04:44 PM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 506 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 19 h 5 m 2 sec
Reputation Power: 385
Hi, I answered on this point in your cross post on the Perl Guru forum.

In brief, tell us more about your file format.
Comments on this post
alpha_omega agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Cant pipe output in perl or shell

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